-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Iconedbuttons and refactored some buttons
- Loading branch information
1 parent
f5415b9
commit 05ddb39
Showing
18 changed files
with
183 additions
and
147 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Cross } from '@components/icons'; | ||
import { Button } from '@components/ui'; | ||
import { ButtonProps } from '@components/ui/Button/Button'; | ||
import { MouseEventHandler, VFC } from 'react'; | ||
|
||
type CloseButtonProps = { | ||
className?: string; | ||
onClick?: MouseEventHandler<HTMLButtonElement>; | ||
} & Pick< | ||
ButtonProps<'button'>, | ||
| 'size' | ||
| 'loading' | ||
| 'circular' | ||
| 'disabled' | ||
| 'outlined' | ||
| 'variant' | ||
| 'squared' | ||
>; | ||
|
||
const CloseButton: VFC<CloseButtonProps> = ({ | ||
onClick, | ||
size = 'sm', | ||
variant = 'minimal', | ||
squared = true, | ||
...props | ||
}) => { | ||
return ( | ||
<Button | ||
aria-label="Close" | ||
data-dismiss="modal" | ||
iconLeft={<Cross />} | ||
onClick={onClick} | ||
type="button" | ||
variant={variant} | ||
size={size} | ||
squared={squared} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default CloseButton; |
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,40 @@ | ||
import { Hamburger } from '@components/icons'; | ||
import { Button } from '@components/ui'; | ||
import { ButtonProps } from '@components/ui/Button/Button'; | ||
import { MouseEventHandler, VFC } from 'react'; | ||
|
||
type MenuButtonProps = { | ||
className?: string; | ||
onClick?: MouseEventHandler<HTMLButtonElement>; | ||
} & Pick< | ||
ButtonProps<'button'>, | ||
| 'size' | ||
| 'loading' | ||
| 'circular' | ||
| 'disabled' | ||
| 'outlined' | ||
| 'variant' | ||
| 'squared' | ||
>; | ||
|
||
const MenuButton: VFC<MenuButtonProps> = ({ | ||
onClick, | ||
size = 'sm', | ||
variant = 'minimal', | ||
squared = true, | ||
...props | ||
}) => ( | ||
<Button | ||
aria-haspopup="true" | ||
aria-label="Navigation menu button" | ||
iconLeft={<Hamburger />} | ||
onClick={onClick} | ||
type="button" | ||
variant={variant} | ||
size={size} | ||
squared={squared} | ||
{...props} | ||
/> | ||
); | ||
|
||
export default MenuButton; |
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,46 @@ | ||
import { Moon, Sun } from '@components/icons'; | ||
import { Button } from '@components/ui'; | ||
import { ButtonProps } from '@components/ui/Button/Button'; | ||
import { useTheme } from 'next-themes'; | ||
import { MouseEventHandler, VFC } from 'react'; | ||
|
||
type ThemeButtonProps = { | ||
className?: string; | ||
onClick?: MouseEventHandler<HTMLButtonElement>; | ||
} & Pick< | ||
ButtonProps<'button'>, | ||
| 'size' | ||
| 'loading' | ||
| 'circular' | ||
| 'disabled' | ||
| 'outlined' | ||
| 'variant' | ||
| 'squared' | ||
>; | ||
|
||
const ThemeButton: VFC<ThemeButtonProps> = ({ | ||
onClick, | ||
size = 'sm', | ||
variant = 'minimal', | ||
squared = true, | ||
...props | ||
}) => { | ||
const { setTheme, theme } = useTheme(); | ||
|
||
return ( | ||
<Button | ||
aria-label="Toggle between themes" | ||
iconLeft={theme === 'light' ? <Moon /> : <Sun />} | ||
onClick={ | ||
onClick ? onClick : () => setTheme(theme === 'light' ? 'dark' : 'light') | ||
} | ||
type="button" | ||
variant={variant} | ||
size={size} | ||
squared={squared} | ||
{...props} | ||
/> | ||
); | ||
}; | ||
|
||
export default ThemeButton; |
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,3 @@ | ||
export { default as CloseButton } from './CloseButton'; | ||
export { default as MenuButton } from './MenuButton'; | ||
export { default as ThemeButton } from './ThemeButton'; |
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
Oops, something went wrong.