CHANGED: README

This commit is contained in:
2024-02-02 14:39:02 +04:00
parent 231bdbec3a
commit d970f5a5b3
23 changed files with 206 additions and 102 deletions

View File

@@ -4,6 +4,7 @@ import { forwardRef } from 'react';
import { Icon } from '../components';
import { ButtonProps } from './button.types';
import { ButtonLayout } from '../button-layout/button-layout';
import { bool, oneOf, string } from 'prop-types';
/**
* Button component
@@ -12,18 +13,32 @@ import { ButtonLayout } from '../button-layout/button-layout';
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
(
{ centralRipple = false, variant, disabled = false, icon, ...props },
{
icon,
className = '',
disabled = false,
variant = 'filled',
centralRipple = false,
...props
},
ref,
) => (
<ButtonLayout
{...props}
centralRipple={centralRipple}
className={`${variant} ${className}`}
disabled={disabled}
ref={ref}
variant={variant ? variant : 'filled'}
>
{icon ? <Icon iconSize={20}>{icon}</Icon> : <></>}
<span className={'label-large'}>{props.children}</span>
</ButtonLayout>
),
);
Button.propTypes = {
icon: string,
children: string,
centralRipple: bool,
variant: oneOf(['filled', 'outlined', 'elevated', 'tonal', 'text']),
};