1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

add step descriptions, button layout

This commit is contained in:
Matthias Kretschmann 2019-02-20 11:12:10 +01:00
parent 2597e8a63c
commit 73f479be22
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 57 additions and 18 deletions

View File

@ -4,6 +4,7 @@
"steps": [ "steps": [
{ {
"title": "Essentials", "title": "Essentials",
"description": "A description about these essential fields",
"fields": { "fields": {
"name": { "name": {
"label": "Title", "label": "Title",
@ -23,6 +24,7 @@
}, },
{ {
"title": "Information", "title": "Information",
"description": "A description about these fields",
"fields": { "fields": {
"description": { "description": {
"label": "Description", "label": "Description",
@ -72,6 +74,7 @@
}, },
{ {
"title": "Credentials", "title": "Credentials",
"description": "A description about these credentials fields",
"fields": { "fields": {
"author": { "author": {
"label": "Author", "label": "Author",

View File

@ -1,5 +1,28 @@
@import '../../styles/variables'; @import '../../styles/variables';
.header {
margin-bottom: $spacer * 1.5;
border-bottom: .1rem solid $brand-grey-lighter;
}
.title { .title {
font-size: $font-size-h2; font-size: $font-size-h2;
margin: 0;
}
.description {
margin-top: $spacer / 4;
}
.actions {
display: flex;
justify-content: space-between;
border-top: .1rem solid $brand-grey-lighter;
padding-top: $spacer;
margin-top: $spacer * 2;
button:last-child {
min-width: 12rem;
margin-left: auto;
}
} }

View File

@ -16,6 +16,7 @@ interface StepProps {
files?: any files?: any
state: any state: any
title: string title: string
description: string
next: any next: any
prev: any prev: any
totalSteps: number totalSteps: number
@ -26,7 +27,11 @@ export default class Step extends PureComponent<StepProps, {}> {
let { currentStep, prev } = this.props let { currentStep, prev } = this.props
if (currentStep !== 1) { if (currentStep !== 1) {
return <Button onClick={prev}>Previous</Button> return (
<Button link onClick={prev}>
Previous
</Button>
)
} }
return null return null
} }
@ -35,7 +40,7 @@ export default class Step extends PureComponent<StepProps, {}> {
let { currentStep, next, totalSteps } = this.props let { currentStep, next, totalSteps } = this.props
if (currentStep < totalSteps) { if (currentStep < totalSteps) {
return <Button onClick={next}>Next</Button> return <Button onClick={next}>Next </Button>
} }
return null return null
} }
@ -45,6 +50,7 @@ export default class Step extends PureComponent<StepProps, {}> {
currentStep, currentStep,
index, index,
title, title,
description,
fields, fields,
inputChange, inputChange,
inputToArrayChange, inputToArrayChange,
@ -59,7 +65,11 @@ export default class Step extends PureComponent<StepProps, {}> {
return ( return (
<> <>
<h3 className={styles.title}>{title}</h3> <header className={styles.header}>
<h2 className={styles.title}>{title}</h2>
<p className={styles.description}>{description}</p>
</header>
{fields && {fields &&
Object.entries(fields).map(([key, value]) => { Object.entries(fields).map(([key, value]) => {
let onChange = inputChange let onChange = inputChange
@ -102,6 +112,7 @@ export default class Step extends PureComponent<StepProps, {}> {
) )
})} })}
<div className={styles.actions}>
{this.previousButton()} {this.previousButton()}
{this.nextButton()} {this.nextButton()}
@ -118,6 +129,7 @@ export default class Step extends PureComponent<StepProps, {}> {
} }
</User.Consumer> </User.Consumer>
)} )}
</div>
</> </>
) )
} }

View File

@ -182,6 +182,7 @@ class Publish extends Component<{}, PublishState> {
key={index} key={index}
index={index} index={index}
title={step.title} title={step.title}
description={step.description}
currentStep={this.state.currentStep} currentStep={this.state.currentStep}
fields={step.fields} fields={step.fields}
inputChange={this.inputChange} inputChange={this.inputChange}