增加Badge组件。
This commit is contained in:
parent
cff2ad0439
commit
7e2132662f
12
src/components/Badge.module.css
Normal file
12
src/components/Badge.module.css
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
@layer components {
|
||||||
|
.badge {
|
||||||
|
padding: var(--spacing-xs) var(--spacing-s);
|
||||||
|
border-radius: var(--border-radius-xs);
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
line-height: 1.2em;
|
||||||
|
}
|
||||||
|
}
|
12
src/components/Badge.tsx
Normal file
12
src/components/Badge.tsx
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import cx from 'clsx';
|
||||||
|
import { ReactNode } from 'react';
|
||||||
|
import styles from './Badge.module.css';
|
||||||
|
|
||||||
|
type BadgeProps = {
|
||||||
|
extendClassName?: HTMLDivElement['className'];
|
||||||
|
children?: ReactNode;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function Badge({ extendClassName, children }: BadgeProps) {
|
||||||
|
return <div className={cx(styles.badge, extendClassName)}>{children}</div>;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user