YesPlayMusic/packages/web/components/IconButton.tsx

33 lines
664 B
TypeScript
Raw Normal View History

2022-03-13 14:40:38 +08:00
import { ReactNode } from 'react'
2022-05-12 02:45:43 +08:00
import cx from 'classnames'
2022-03-13 14:40:38 +08:00
const IconButton = ({
children,
onClick,
disabled,
className,
}: {
children: ReactNode
onClick: () => void
disabled?: boolean | undefined
className?: string
}) => {
return (
<button
onClick={onClick}
disabled={disabled}
2022-05-12 02:45:43 +08:00
className={cx(
2022-03-13 14:40:38 +08:00
className,
2022-03-21 02:03:25 +08:00
'relative transform cursor-default p-1.5 transition duration-200',
2022-03-13 14:40:38 +08:00
!disabled &&
2022-03-17 14:45:04 +08:00
'btn-pressed-animation btn-hover-animation after:bg-black/[.06] dark:after:bg-white/10',
2022-03-13 14:40:38 +08:00
disabled && 'opacity-30'
)}
>
{children}
</button>
)
}
export default IconButton