Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(IconButton): Complete component IconButton
- Loading branch information
Showing
16 changed files
with
927 additions
and
62 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
60 changes: 60 additions & 0 deletions
60
packages/fluent-ui.com/src/docs/components/IconButton/README.md
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,60 @@ | ||
--- | ||
title: IconButton | ||
components: IconButton | ||
--- | ||
|
||
# IconButtons | ||
|
||
## Variant | ||
|
||
Button default style | ||
|
||
```jsx | ||
<IconButton> | ||
<Icon.Accept /> | ||
</IconButton> | ||
``` | ||
|
||
Highlighted button | ||
|
||
```jsx | ||
<IconButton variant="accent"> | ||
<Icon.Accept /> | ||
</IconButton> | ||
``` | ||
|
||
## Disabled | ||
|
||
```jsx | ||
<IconButton disabled> | ||
<Icon.Accept /> | ||
</IconButton> | ||
``` | ||
|
||
## Sizes | ||
|
||
Use the `size` property. | ||
|
||
```jsx | ||
<> | ||
<IconButton size="small" variant="accent"> | ||
<Icon.Accept /> | ||
</IconButton> | ||
<IconButton size="medium" variant="accent"> | ||
<Icon.Accept /> | ||
</IconButton> | ||
<IconButton size="large" variant="accent"> | ||
<Icon.Accept /> | ||
</IconButton> | ||
</> | ||
``` | ||
|
||
## As | ||
|
||
As a | ||
|
||
```jsx | ||
<IconButton as="a" href="#"> | ||
<Icon.Accept /> | ||
</IconButton> | ||
``` |
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
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,70 @@ | ||
import { styled, th, css, variant } from '../styles/styled' | ||
import { IconButtonProps } from './IconButton' | ||
|
||
const base = css` | ||
border: none; | ||
outline: none; | ||
padding: 12px; | ||
line-height: 1; | ||
display: inline-flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
color: inherit; | ||
transition: ${th.transition('button')}; | ||
&:hover { | ||
background-color: ${th.color('primary.light2')}; | ||
} | ||
&:active { | ||
color: ${th.color('black.default')}; | ||
background-color: ${th.color('primary.default')}; | ||
} | ||
&:disabled { | ||
color: ${th.color('primary.dark3')}; | ||
background-color: ${th.color('primary.default')}; | ||
cursor: not-allowed; | ||
pointer-events: none; | ||
} | ||
` | ||
|
||
const variants = variant({ | ||
prop: 'variant', | ||
default: 'primary', | ||
variants: { | ||
primary: css``, | ||
accent: css` | ||
color: ${th.color('white.default')}; | ||
background-color: ${th.color('accent.default')}; | ||
&:hover { | ||
background-color: ${th.color('accent.dark1')}; | ||
} | ||
&:active { | ||
color: ${th.color('white.default')}; | ||
background-color: ${th.color('accent.default')}; | ||
} | ||
` | ||
} | ||
}) | ||
|
||
const sizes = variant({ | ||
prop: 'size', | ||
default: 'medium', | ||
variants: { | ||
small: css` | ||
${th.size('small.iconButton')} | ||
`, | ||
medium: css` | ||
${th.size('medium.iconButton')} | ||
`, | ||
large: css` | ||
${th.size('large.iconButton')} | ||
` | ||
} | ||
}) | ||
|
||
export const IconButtonStyled = styled.button<IconButtonProps>` | ||
${base} | ||
${variants} | ||
${sizes} | ||
` |
Oops, something went wrong.