Initial commit 🚀
This commit is contained in:
commit
fd58a8d32f
235 files changed
+19775
No files matched your search
@@ -0,0 +1,26 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import { cx } from './cx';
|
||||
|
||||
export interface ButtonProps {
|
||||
/** Renders an anchor when set, a button element otherwise. */
|
||||
href?: string;
|
||||
size?: 'default' | 'small';
|
||||
children?: ReactNode;
|
||||
}
|
||||
|
||||
/** A filled action. Its label names the action: "Talk to us", never "Learn more". */
|
||||
export function Button({ href, size = 'default', children }: ButtonProps) {
|
||||
const className = cx('button', size === 'small' && 'button--small');
|
||||
if (href) {
|
||||
return (
|
||||
<a className={className} href={href}>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<button className={className} type="button">
|
||||
{children}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user