mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
feat(app): create react button component [EE-1948] (#6022)
Co-authored-by: Chaim Lev-Ari <chiptus@gmail.com>
This commit is contained in:
parent
6b91a813f0
commit
41993ad378
14 changed files with 432 additions and 2 deletions
29
app/portainer/components/Button/ButtonGroup.tsx
Normal file
29
app/portainer/components/Button/ButtonGroup.tsx
Normal file
|
@ -0,0 +1,29 @@
|
|||
import { PropsWithChildren } from 'react';
|
||||
import clsx from 'clsx';
|
||||
|
||||
type Size = 'xsmall' | 'small' | 'large';
|
||||
export interface Props {
|
||||
size?: Size;
|
||||
}
|
||||
|
||||
export function ButtonGroup({
|
||||
size = 'small',
|
||||
children,
|
||||
}: PropsWithChildren<Props>) {
|
||||
return (
|
||||
<div className={clsx('btn-group', sizeClass(size))} role="group">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function sizeClass(size: Size | undefined) {
|
||||
switch (size) {
|
||||
case 'xsmall':
|
||||
return 'btn-group-xs';
|
||||
case 'large':
|
||||
return 'btn-group-lg';
|
||||
default:
|
||||
return 'btn-group-sm';
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue