Skip to content

Commit

Permalink
Merge pull request #24 from unicef/feature/select-fixes
Browse files Browse the repository at this point in the history
Feature/select fixes
  • Loading branch information
merlos authored Feb 18, 2020
2 parents c0384d2 + 568eb10 commit f9a7fd8
Show file tree
Hide file tree
Showing 12 changed files with 267 additions and 688 deletions.
121 changes: 86 additions & 35 deletions example/package-lock.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"react-material-ui-form-validator": "^2.0.9",
"react-router-dom": "^5.1.2",
"react-scripts": "3.0.1",
"styled-components": "^4.4.1",
"unicef-material-ui": "file:.."
},
"scripts": {
Expand Down
48 changes: 0 additions & 48 deletions example/src/components/FormValidator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
Grid,
} from '@material-ui/core'
import {
USelect,
UTextField,
UPeoplePicker,
UValidatorForm,
Expand Down Expand Up @@ -74,19 +73,6 @@ const options = [
imageUrl: option.imageUrl,
}))

const suggestions = [
{ label: 'Afghanistan' },
{ label: 'Aland Islands' },
{ label: 'Albania' },
{ label: 'Algeria' },
{ label: 'American Samoa' },
{ label: 'Andorra' },
{ label: 'Angola' },
].map(option => ({
value: option.label,
label: option.label,
}))

const useStyles = makeStyles(theme => ({
container: {
display: 'flex',
Expand Down Expand Up @@ -146,12 +132,10 @@ export default function FormValidator() {

const [isLoading, setLoading] = useState(true)
const [gotOptions, setOptions] = useState([''])
const [gotSuggestions, setSuggestions] = useState([''])

useEffect(() => {
setTimeout(() => {
setOptions(options)
setSuggestions(suggestions)
setLoading(false)
}, 3000)
return () => clearTimeout()
Expand All @@ -174,38 +158,6 @@ export default function FormValidator() {

return (
<React.Fragment>
<Grid container spacing={1}>
<Grid item xs={12}>
<Typography variant="h5" style={{ margin: '16px 0px' }}>
USelect
</Typography>
</Grid>
<Grid item xs={12} md={6}>
<USelect
label="Select"
TextFieldProps={{
helperText: 'Select country from list',
}}
isLoading={isLoading}
placeholder="Select country ..."
options={gotSuggestions}
// onChange={handleChange}
/>
</Grid>
<Grid item xs={12} md={6}>
<USelect
label="Multi Select"
TextFieldProps={{
helperText: 'Please select multiple counties from list',
}}
isLoading={isLoading}
placeholder="Select countries ..."
options={gotSuggestions}
// onChange={handleChange}
isMulti
/>
</Grid>
</Grid>
<Grid container spacing={1}>
<Grid item xs={12}>
<Typography variant="h5" style={{ margin: '16px 0px' }}>
Expand Down
Loading

0 comments on commit f9a7fd8

Please sign in to comment.