Feat: update icon and Divider components (#10975)

This commit is contained in:
NFish
2024-11-22 15:44:42 +08:00
committed by GitHub
parent 5b415a6227
commit 8a83edc1b5
6 changed files with 58 additions and 23 deletions

View File

@@ -1,17 +1,31 @@
import type { CSSProperties, FC } from 'react'
import React from 'react'
import s from './style.module.css'
import { type VariantProps, cva } from 'class-variance-authority'
import classNames from '@/utils/classnames'
type Props = {
type?: 'horizontal' | 'vertical'
// orientation?: 'left' | 'right' | 'center'
const dividerVariants = cva(
'bg-divider-regular',
{
variants: {
type: {
horizontal: 'w-full h-[0.5px] my-2',
vertical: 'w-[1px] h-full mx-2',
},
},
defaultVariants: {
type: 'horizontal',
},
},
)
type DividerProps = {
className?: string
style?: CSSProperties
}
} & VariantProps<typeof dividerVariants>
const Divider: FC<Props> = ({ type = 'horizontal', className = '', style }) => {
const Divider: FC<DividerProps> = ({ type, className = '', style }) => {
return (
<div className={`${s.divider} ${s[type]} ${className}`} style={style}></div>
<div className={classNames(dividerVariants({ type }), className)} style={style}></div>
)
}

View File

@@ -1,9 +0,0 @@
.divider {
@apply bg-gray-200;
}
.horizontal {
@apply w-full h-[0.5px] my-2;
}
.vertical {
@apply w-[1px] h-full mx-2;
}