2023-12-15 17:34:50 +03:00
|
|
|
import clsx from 'clsx';
|
|
|
|
|
2023-12-13 14:32:57 +03:00
|
|
|
import { useConceptTheme } from '@/context/ThemeContext';
|
|
|
|
import { GramData } from '@/models/language';
|
|
|
|
import { colorfgGrammeme } from '@/utils/color';
|
|
|
|
import { labelGrammeme } from '@/utils/labels';
|
2023-12-08 19:24:08 +03:00
|
|
|
|
|
|
|
interface GrammemeBadgeProps {
|
|
|
|
key?: string
|
|
|
|
grammeme: GramData
|
|
|
|
}
|
|
|
|
|
|
|
|
function GrammemeBadge({ key, grammeme }: GrammemeBadgeProps) {
|
|
|
|
const { colors } = useConceptTheme();
|
|
|
|
return (
|
|
|
|
<div
|
|
|
|
key={key}
|
2023-12-15 17:34:50 +03:00
|
|
|
className={clsx(
|
|
|
|
'min-w-[3rem]',
|
|
|
|
'px-1',
|
|
|
|
'border rounded-md',
|
|
|
|
'text-sm font-semibold text-center whitespace-nowrap'
|
|
|
|
)}
|
2023-12-08 19:24:08 +03:00
|
|
|
style={{
|
|
|
|
borderColor: colorfgGrammeme(grammeme, colors),
|
|
|
|
color: colorfgGrammeme(grammeme, colors),
|
|
|
|
backgroundColor: colors.bgInput
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{labelGrammeme(grammeme)}
|
|
|
|
</div>);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default GrammemeBadge;
|