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';
|
2024-01-06 03:15:02 +03:00
|
|
|
import { colorFgGrammeme } from '@/styling/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(
|
2024-01-04 14:35:46 +03:00
|
|
|
'min-w-[3rem]', // prettier: split lines
|
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;
|