Portal/rsconcept/frontend/src/features/rsform/components/BadgeGrammeme.tsx
2025-02-19 23:29:45 +03:00

36 lines
809 B
TypeScript

import clsx from 'clsx';
import { APP_COLORS } from '@/styling/colors';
import { colorFgGrammeme } from '../colors';
import { labelGrammeme } from '../labels';
import { GramData } from '../models/language';
interface BadgeGrammemeProps {
/** Grammeme to display. */
grammeme: GramData;
}
/**
* Displays a badge with a grammeme tag.
*/
export function BadgeGrammeme({ grammeme }: BadgeGrammemeProps) {
return (
<div
className={clsx(
'min-w-[3rem]', //
'px-1',
'border rounded-md',
'text-sm font-medium text-center whitespace-nowrap'
)}
style={{
borderColor: colorFgGrammeme(grammeme),
color: colorFgGrammeme(grammeme),
backgroundColor: APP_COLORS.bgInput
}}
>
{labelGrammeme(grammeme)}
</div>
);
}