* change root dit and change way to import modules * update deps to latest versions * use latest tools for building bundles * rewrite webpack config * use nomodule technique for loading modern bundle * inject polyfills by babel usebuiltins * update eslint rules * rename all style files to CSS * use postcss preset env for building styles * proper typescript typing * put all html files to templates folder * etc
23 lines
695 B
TypeScript
23 lines
695 B
TypeScript
import { h, JSX } from 'preact';
|
|
import { forwardRef } from 'preact/compat';
|
|
import b, { Mods, Mix } from 'bem-react-helper';
|
|
|
|
import type { Theme } from 'common/types';
|
|
|
|
export type ButtonProps = Omit<JSX.HTMLAttributes, 'size' | 'className'> & {
|
|
kind?: 'primary' | 'secondary' | 'link';
|
|
size?: 'middle' | 'large';
|
|
theme?: Theme;
|
|
mods?: Mods;
|
|
mix?: Mix;
|
|
type?: string;
|
|
};
|
|
|
|
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
({ children, theme, mods, mix, kind, type = 'button', size, ...props }, ref) => (
|
|
<button className={b('button', { mods: { kind, size, theme }, mix }, { ...mods })} type={type} {...props} ref={ref}>
|
|
{children}
|
|
</button>
|
|
)
|
|
);
|