menu with toggle updated; even icons changed
This commit is contained in:
1 parent
1181bd61fd
commit
79658002d5
10 files changed
+140
-147
No files matched your search
@@ -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>
|
||||
)
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
.button {
|
||||
display: block;
|
||||
font-size: var(--font-size-default);
|
||||
|
||||
text-align: center;
|
||||
margin-top: var(--size-m);
|
||||
margin-bottom: var(--size-m);
|
||||
|
||||
border-radius: 100px;
|
||||
border: 1px solid var(--color-shadow);
|
||||
@@ -17,8 +16,9 @@
|
||||
}
|
||||
|
||||
.button:hover {
|
||||
margin-left: 1px;
|
||||
margin-right: 1px;
|
||||
margin: 1px;
|
||||
/* margin-left: 1px;
|
||||
margin-right: 1px; */
|
||||
|
||||
border: none;
|
||||
box-shadow: var(--shadow-active);
|
||||
@@ -31,19 +31,23 @@
|
||||
color: var(--color-text-second);
|
||||
}
|
||||
|
||||
/* THEME */
|
||||
|
||||
.button.ghost {
|
||||
border-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* SIZE */
|
||||
|
||||
.button.default {
|
||||
.button.size_default {
|
||||
padding: var(--size-s) var(--size-m);
|
||||
}
|
||||
|
||||
.button.small {
|
||||
.button.size_small {
|
||||
padding: var(--size-xs) var(--size-s);
|
||||
font-size: var(--font-size-second);
|
||||
}
|
||||
|
||||
/* THEME */
|
||||
|
||||
.button.theme_ghost {
|
||||
border-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.button.theme_icon {
|
||||
padding: var(--size-xs) var(--size-xs);
|
||||
}
|
||||
Reference in new issue
Block a user