-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1727 from cozy/buttons
- Loading branch information
Showing
5 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,83 @@ | ||
``` | ||
import Button from 'cozy-ui/transpiled/react/MuiCozyTheme/Buttons'; | ||
import Typography from 'cozy-ui/transpiled/react/Typography'; | ||
import Icon from 'cozy-ui/transpiled/react/Icon' | ||
import Stack from 'cozy-ui/transpiled/react/Stack' | ||
import WrenchCircleIcon from 'cozy-ui/transpiled/react/Icons/WrenchCircle' | ||
const ButtonsVariant = ({variant}) => { | ||
const ButtonsVariant = ({variant, size }) => { | ||
return ( | ||
<div> | ||
<Button variant={variant} className='u-m-1'>Default</Button> | ||
<Button variant={variant} color="primary" className='u-m-1'>Primary</Button> | ||
<Button variant={variant} color="secondary" className='u-m-1'>Secondary</Button> | ||
<Button variant={variant} disabled className='u-m-1'>Disabled</Button> | ||
<Button variant={variant} href="#text-buttons" className='u-m-1'>Link</Button> | ||
<input accept="image/*" className='u-hide' id="flat-button-file" multiple type="file" /> | ||
<label htmlFor="flat-button-file"> | ||
<Button variant={variant} component="span" className='u-m-1'>Upload</Button> | ||
</label> | ||
<Button variant={variant} size={size}> | ||
<Icon icon={WrenchCircleIcon} className='u-mr-half' /> | ||
Default | ||
</Button> | ||
<Button variant={variant} size={size} color="primary" className='u-ml-half'> | ||
<Icon icon={WrenchCircleIcon} className='u-mr-half' /> | ||
Primary | ||
</Button> | ||
<Button variant={variant} size={size} color="secondary" className='u-ml-half'>Secondary</Button> | ||
<Button variant={variant} size={size} disabled className='u-ml-half'>Disabled</Button> | ||
<Button variant={variant} size={size} href="#text-buttons" className='u-ml-half'>Link</Button> | ||
</div> | ||
) | ||
} | ||
<>Text Buttons:<ButtonsVariant />Outlined Buttons:<ButtonsVariant variant='outlined' />Contained Buttons:<ButtonsVariant variant='contained' /></> | ||
const StateRadio = ({ name, ...props }) => { | ||
return <input | ||
type='radio' | ||
name={name} | ||
checked={state[name] == props.value} | ||
onChange={() => setState({ [name]: props.value })} | ||
{...props} | ||
/> | ||
} | ||
const Example = ({ size, className }) => { | ||
return ( | ||
<Stack spacing='s'> | ||
<div> | ||
<Typography variant='subtitle1' gutterBottom>Text Buttons</Typography> | ||
<ButtonsVariant size={size} /> | ||
</div> | ||
<div> | ||
<Typography variant='subtitle1' gutterBottom>Outlined Buttons</Typography> | ||
<ButtonsVariant variant='outlined' size={size}/> | ||
</div> | ||
<div> | ||
<Typography variant='subtitle1' gutterBottom>Contained buttons</Typography> | ||
<ButtonsVariant variant='contained' size={size} /> | ||
</div> | ||
</Stack> | ||
) | ||
} | ||
initialState = { | ||
size: 'medium' | ||
}; | ||
<> | ||
{true || isTesting() | ||
? | ||
<Stack spacing='l'> | ||
{['small', 'medium', 'large'].map(size => ( | ||
<Stack spacing='xs'> | ||
<Typography variant='h3'>{ size }</Typography> | ||
<Example size={size} /> | ||
</Stack> | ||
))} | ||
</Stack> : | ||
<Stack spacing='m'> | ||
<div> | ||
<StateRadio value='small' name='size' /> small{' '} | ||
<StateRadio value='medium' name='size' /> medium{' '} | ||
<StateRadio value='large' name='size' /> large | ||
</div> | ||
<div> | ||
<Example size={state.size} /> | ||
</div> | ||
</Stack> | ||
} | ||
</> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters