增加Badge组件。

This commit is contained in:
徐涛 2025-01-24 10:09:14 +08:00
parent cff2ad0439
commit 7e2132662f
2 changed files with 24 additions and 0 deletions

View 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
View 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>;
}