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

frontpage form tweaks, disable button based on input state

This commit is contained in:
Matthias Kretschmann 2019-03-04 13:59:21 -03:00
parent 49efed73c7
commit b3459547e3
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 26 additions and 4 deletions

View File

@ -13,6 +13,13 @@
} }
} }
.formMinimal {
composes: form;
background: none;
padding: 0;
border: 0;
}
.formHeader { .formHeader {
margin-bottom: $spacer; margin-bottom: $spacer;
} }

View File

@ -6,14 +6,20 @@ const Form = ({
description, description,
children, children,
onSubmit, onSubmit,
minimal,
...props ...props
}: { }: {
title?: string title?: string
description?: string description?: string
children: any children: any
onSubmit?: any onSubmit?: any
minimal?: boolean
}) => ( }) => (
<form className={styles.form} onSubmit={onSubmit} {...props}> <form
className={minimal ? styles.formMinimal : styles.form}
onSubmit={onSubmit}
{...props}
>
{title && ( {title && (
<header className={styles.formHeader}> <header className={styles.formHeader}>
<h1 className={styles.formTitle}>{title}</h1> <h1 className={styles.formTitle}>{title}</h1>

View File

@ -2,6 +2,11 @@
.home { .home {
display: block; display: block;
form {
margin-top: $spacer * 2;
margin-bottom: $spacer * 4;
}
} }
.published { .published {

View File

@ -26,15 +26,19 @@ class Home extends Component<HomeProps, HomeState> {
description={meta.description} description={meta.description}
className={styles.home} className={styles.home}
> >
<Form onSubmit={this.searchAssets}> <Form onSubmit={this.searchAssets} minimal>
<Input <Input
type="search" type="search"
name="search" name="search"
label="Search" label="Search for data sets"
placeholder="i.e. almond sales data" placeholder="i.e. almond sales data"
value={this.state.search} value={this.state.search}
onChange={this.inputChange} onChange={this.inputChange}
group={<Button>Search</Button>} group={
<Button primary disabled={!this.state.search}>
Search
</Button>
}
/> />
</Form> </Form>