menu with toggle updated; even icons changed

This commit is contained in:
tmshv committed 2020-02-23 07:43:26 +03:00
1 parent 1181bd61fd
commit 79658002d5
10 files changed
+140 -147

No files matched your search

+15 -3
View File
@@ -2,19 +2,27 @@ import './styles.css'
import Link from 'next/link'
import cx from 'classnames'
import { useCallback } from 'react'
export type ButtonProps = {
value?: any
style?: React.CSSProperties
href?: string
theme?: 'default' | 'ghost'
theme?: 'default' | 'ghost' | 'icon'
size?: 'default' | 'small'
disabled?: boolean
onClick?: (value: any, event: MouseEvent) => void
}
export const Button: React.FC<ButtonProps> = ({ size = 'default', theme = 'default', disabled = false, ...props }) => {
const className = cx('button', theme, size, {
const className = cx('button', `size_${size}`, `theme_${theme}`, {
disabled
})
const onClick = useCallback(event => {
if (props.onClick) {
props.onClick(props.value, event)
}
}, [props.value, props.onClick])
if (props.href) {
return (
@@ -27,7 +35,11 @@ export const Button: React.FC<ButtonProps> = ({ size = 'default', theme = 'defau
}
return (
<button className={className} style={props.style}>
<button
className={className}
style={props.style}
onClick={onClick}
>
{props.children}
</button>
)