-
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 #1423 from cozy/dropdown-button
feat: Added DropdownButton component
- Loading branch information
Showing
6 changed files
with
88 additions
and
8 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
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
This component can be used as a trigger to open menus, for example an ActionMenu component. | ||
|
||
``` | ||
import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton'; | ||
import Text, { MainTitle, Title, SubTitle } from 'cozy-ui/transpiled/react/Text'; | ||
<div> | ||
<div> | ||
<DropdownButton> | ||
<MainTitle>Cozy</MainTitle> | ||
</DropdownButton> | ||
</div> | ||
<div> | ||
<DropdownButton> | ||
<Title>Cozy</Title> | ||
</DropdownButton> | ||
</div> | ||
<div> | ||
<DropdownButton> | ||
<SubTitle>Cozy</SubTitle> | ||
</DropdownButton> | ||
</div> | ||
<div> | ||
<DropdownButton> | ||
<Text>Cozy</Text> | ||
</DropdownButton> | ||
</div> | ||
</div> | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react' | ||
import cx from 'classnames' | ||
import styles from './styles.styl' | ||
import Icon from '../Icon' | ||
|
||
const DropdownButton = React.forwardRef( | ||
({ children, className, ...props }, ref) => ( | ||
<button | ||
role="button" | ||
className={cx(styles['c-DropdownButton'], className)} | ||
ref={ref} | ||
{...props} | ||
> | ||
{children} | ||
<Icon | ||
icon="bottom" | ||
size="12" | ||
className={styles['c-DropdownButton-Icon']} | ||
/> | ||
</button> | ||
) | ||
) | ||
|
||
export default DropdownButton |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@require '../../stylus/settings/spaces' | ||
@require '../../stylus/tools/mixins' | ||
|
||
.c-DropdownButton | ||
display inline-flex | ||
align-items center | ||
background none | ||
border 0 | ||
cursor pointer | ||
padding spacing_values.xs spacing_values.m | ||
|
||
.c-DropdownButton-Icon | ||
margin-top rem(4) | ||
margin-left rem(4) |
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