-
Notifications
You must be signed in to change notification settings - Fork 751
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f8267cb
commit 1b34b28
Showing
12 changed files
with
70 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from "react"; | ||
import StyledButton from "./StyledButton"; | ||
import { ButtonProps, variants, sizes } from "./types"; | ||
|
||
const Button: React.FC<ButtonProps> = ({ startIcon, endIcon, children, ...props }) => ( | ||
<StyledButton {...props}> | ||
{React.isValidElement(startIcon) && | ||
React.cloneElement(startIcon, { | ||
mr: "0.5rem", | ||
})} | ||
{children} | ||
{React.isValidElement(endIcon) && | ||
React.cloneElement(endIcon, { | ||
ml: "0.5rem", | ||
})} | ||
</StyledButton> | ||
); | ||
|
||
Button.defaultProps = { | ||
variant: variants.PRIMARY, | ||
size: sizes.MD, | ||
}; | ||
|
||
export default Button; |
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,10 @@ | ||
import styled from "styled-components"; | ||
import Button from "./Button"; | ||
import { ButtonProps } from "./types"; | ||
|
||
const IconButton = styled(Button)<ButtonProps>` | ||
padding: 0; | ||
width: ${({ size }) => (size === "sm" ? "32px" : "48px")}; | ||
`; | ||
|
||
export default 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,2 @@ | ||
import React from "react"; | ||
import StyledButton from "./StyledButton"; | ||
import { ButtonProps, variants, sizes } from "./types"; | ||
|
||
const Button: React.FC<ButtonProps> = ({ startIcon, endIcon, children, ...props }) => ( | ||
<StyledButton {...props}> | ||
{React.isValidElement(startIcon) && | ||
React.cloneElement(startIcon, { | ||
mr: "0.5rem", | ||
})} | ||
{children} | ||
{React.isValidElement(endIcon) && | ||
React.cloneElement(endIcon, { | ||
ml: "0.5rem", | ||
})} | ||
</StyledButton> | ||
); | ||
|
||
Button.defaultProps = { | ||
variant: variants.PRIMARY, | ||
size: sizes.MD, | ||
}; | ||
|
||
export default Button; | ||
export { default as Button } from "./Button"; | ||
export { default as IconButton } from "./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
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