init: the first public commit for AFFiNE

This commit is contained in:
DarkSky
2022-07-22 15:49:21 +08:00
commit e3e3741393
1451 changed files with 108124 additions and 0 deletions
@@ -0,0 +1,61 @@
import clsx from 'clsx';
import style9 from 'style9';
const styles = style9.create({
ligoButton: {
border: 'none',
outline: 'none',
// backgroundColor: 'white',
cursor: 'pointer',
':hover': {
backgroundColor: '#edeef0',
},
},
});
export type ButtonType =
| 'default'
| 'primary'
| 'ghost'
| 'dashed'
| 'link'
| 'text';
export type SizeType = 'small' | 'medium' | 'large';
export type ButtonProps = {
type?: ButtonType;
size?: SizeType;
icon?: React.ReactNode;
className?: string;
children?: React.ReactNode;
onClick?: React.MouseEventHandler<HTMLElement>;
style?: React.CSSProperties;
};
export default function Button(props: ButtonProps) {
const { className, type, style, size, children } = props;
const classes = clsx(
styles('ligoButton'),
{
[`${styles('ligoButton')}-${type}`]: type,
[`${styles('ligoButton')}-icon-only`]: !children && children !== 0,
},
className
);
const handleClick = (
e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement, MouseEvent>
) => {
const { onClick } = props;
(
onClick as React.MouseEventHandler<
HTMLButtonElement | HTMLAnchorElement
>
)?.(e);
};
return (
<button className={classes} style={style || {}} onClick={handleClick}>
{children}
</button>
);
}