1
0
Fork 0
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:
Marcelo Rydel 2021-11-16 05:33:01 -07:00 committed by GitHub
parent 6b91a813f0
commit 41993ad378
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 432 additions and 2 deletions

View 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';
}
}