summaryrefslogtreecommitdiff
path: root/src/components/Button.tsx
blob: 8f094ce7d69a40ceb402934b6dac53e7f41e9993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import type { ComponentChildren } from 'preact';
import './Button.css';

export interface ButtonProps {
	children: ComponentChildren;
	kind?: 'primary' | 'outline' | 'ghost';
	[prop: string]: any;
}

const Button = ({ children, kind = 'primary', ...props }: ButtonProps) => {
	const Elem = props.href ? 'a' : 'button';
	return (
		<Elem {...props} class={(props.class || '') + ' __Button ' + kind}>
			{children}
		</Elem>
	);
};

export default Button;