mirror of
https://github.com/vercel/commerce.git
synced 2025-07-29 05:01:22 +00:00
init: label common
This commit is contained in:
38
src/components/common/LabelCommon/LabelCommon.module.scss
Normal file
38
src/components/common/LabelCommon/LabelCommon.module.scss
Normal file
@@ -0,0 +1,38 @@
|
||||
.labelCommonWarper{
|
||||
display: inline-flex;
|
||||
font-weight: bold;
|
||||
&.defaultSize{
|
||||
max-height: 2rem;
|
||||
line-height: 2rem;
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
&.largeSize{
|
||||
max-height: 2.4rem;
|
||||
line-height: 2.4rem;
|
||||
font-size: 1.6rem;
|
||||
}
|
||||
&.defaultType{
|
||||
@apply bg-positive-dark;
|
||||
}
|
||||
&.discountType{
|
||||
@apply bg-negative;
|
||||
}
|
||||
&.waitingType{
|
||||
@apply bg-warning;
|
||||
}
|
||||
&.deliveringType{
|
||||
@apply bg-info;
|
||||
}
|
||||
&.deliveredType{
|
||||
@apply bg-positive;
|
||||
}
|
||||
&.defaultShape{
|
||||
border-radius: 0.4rem;
|
||||
}
|
||||
&.halfShape{
|
||||
border-radius: 0px 1.4rem 1.4rem 0px;
|
||||
}
|
||||
&.roundShape{
|
||||
border-radius: 1.4rem;
|
||||
}
|
||||
}
|
30
src/components/common/LabelCommon/LabelCommon.tsx
Normal file
30
src/components/common/LabelCommon/LabelCommon.tsx
Normal file
@@ -0,0 +1,30 @@
|
||||
import classNames from 'classnames'
|
||||
import React from 'react'
|
||||
import s from './LabelCommon.module.scss'
|
||||
interface LabelCommonProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
size?: 'default' | 'large'
|
||||
shape?: 'half' | 'round' | 'default'
|
||||
type?: 'default' | 'discount' | 'waiting' | 'delivering' | 'delivered'
|
||||
color?: string
|
||||
}
|
||||
|
||||
const LabelCommon = ({
|
||||
size = 'default',
|
||||
type = 'default',
|
||||
shape = "default",
|
||||
children,
|
||||
}: LabelCommonProps) => {
|
||||
return (
|
||||
<div
|
||||
className={classNames(s.labelCommonWarper, {
|
||||
[s[`${size}Size`]]: size,
|
||||
[s[`${type}Type`]]: type,
|
||||
[s[`${shape}Shape`]]: shape,
|
||||
})}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default LabelCommon
|
Reference in New Issue
Block a user