-
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
ButtonGroup
and Toolbar
component
- Loading branch information
Showing
6 changed files
with
100 additions
and
0 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,46 @@ | ||
import { ElementType, ReactNode } from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface ButtonGroupProps { | ||
/** | ||
* The button size. | ||
*/ | ||
size?: 'sm' | 'md' | 'lg'; | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
/** | ||
* Button contents. | ||
*/ | ||
children: ReactNode; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export function ButtonGroup({ | ||
size = 'md', | ||
children, | ||
className, | ||
...props | ||
}: ButtonGroupProps) { | ||
return ( | ||
<div | ||
className={clsx( | ||
'btn-group', | ||
{ | ||
[`btn-group-${size}`]: size !== 'md', | ||
}, | ||
className | ||
)} | ||
role="group" | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default ButtonGroup; |
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,2 @@ | ||
export { default } from './ButtonGroup'; | ||
export type { ButtonGroupProps } from './ButtonGroup'; |
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,38 @@ | ||
import { ReactNode } from 'react'; | ||
|
||
import clsx from 'clsx'; | ||
|
||
export interface ToolbarProps { | ||
/** | ||
* Custom classes for the label | ||
*/ | ||
className?: string; | ||
/** | ||
* Button contents. | ||
*/ | ||
children: ReactNode; | ||
} | ||
|
||
/** | ||
* Primary UI component for user interaction | ||
*/ | ||
export function Toolbar({ | ||
children, | ||
className, | ||
...props | ||
}: ToolbarProps) { | ||
return ( | ||
<div | ||
className={clsx( | ||
'btn-toolbar', | ||
className | ||
)} | ||
role="toolbar" | ||
{...props} | ||
> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Toolbar; |
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,2 @@ | ||
export { default } from './Toolbar'; | ||
export type { ToolbarProps } from './Toolbar'; |
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