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';
|
2023-12-26 14:23:51 +03:00
|
|
|
import { colorFgGrammeme } from '@/utils/color';
|
2023-12-13 14:32:57 +03:00
|
|
|
import { labelGrammeme } from '@/utils/labels';
|
2023-12-08 19:24:08 +03:00
|
|
|
|
|
|
|
interface GrammemeBadgeProps {
|
2023-12-28 14:04:44 +03:00
|
|
|
key?: string;
|
|
|
|
grammeme: GramData;
|
2023-12-08 19:24:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
function GrammemeBadge({ key, grammeme }: GrammemeBadgeProps) {
|
|
|
|
const { colors } = useConceptTheme();
|
|
|
|
return (
|
2023-12-28 14:04:44 +03:00
|
|
|
<div
|
|
|
|
key={key}
|
|
|
|
className={clsx(
|
2023-12-30 19:43:24 +03:00
|
|
|
'min-w-[3rem]', //
|
2023-12-28 14:04:44 +03:00
|
|
|
'px-1',
|
|
|
|
'border rounded-md',
|
2023-12-30 19:43:24 +03:00
|
|
|
'text-sm font-medium text-center whitespace-nowrap'
|
2023-12-28 14:04:44 +03:00
|
|
|
)}
|
|
|
|
style={{
|
|
|
|
borderColor: colorFgGrammeme(grammeme, colors),
|
|
|
|
color: colorFgGrammeme(grammeme, colors),
|
|
|
|
backgroundColor: colors.bgInput
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{labelGrammeme(grammeme)}
|
|
|
|
</div>
|
|
|
|
);
|
2023-12-08 19:24:08 +03:00
|
|
|
}
|
|
|
|
|
2023-12-28 14:04:44 +03:00
|
|
|
export default GrammemeBadge;
|