ConceptPortal-public/rsconcept/frontend/src/components/info/BadgeGrammeme.tsx

34 lines
861 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { useConceptOptions } from '@/context/ConceptOptionsContext';
import { GramData } from '@/models/language';
import { colorFgGrammeme } from '@/styling/color';
import { labelGrammeme } from '@/utils/labels';
2023-12-08 19:24:08 +03:00
2024-05-16 22:39:28 +03:00
interface BadgeGrammemeProps {
2023-12-28 14:04:44 +03:00
grammeme: GramData;
2023-12-08 19:24:08 +03:00
}
2024-05-16 22:39:28 +03:00
function BadgeGrammeme({ grammeme }: BadgeGrammemeProps) {
2024-04-01 19:07:20 +03:00
const { colors } = useConceptOptions();
2023-12-08 19:24:08 +03:00
return (
2023-12-28 14:04:44 +03:00
<div
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
}
2024-05-16 22:39:28 +03:00
export default BadgeGrammeme;