Files
vscode-front-matter/src/panelWebView/components/Fields/ChoiceButton.tsx
T
2024-01-15 13:48:21 +01:00

30 lines
816 B
TypeScript

import { XMarkIcon } from '@heroicons/react/24/outline';
import * as React from 'react';
import * as l10n from '@vscode/l10n';
import { LocalizationKey } from '../../../localization';
export interface IChoiceButtonProps {
title: string;
value: string;
className?: string;
onClick: (value: string) => void;
}
export const ChoiceButton: React.FunctionComponent<IChoiceButtonProps> = ({
title,
value,
className,
onClick
}: React.PropsWithChildren<IChoiceButtonProps>) => {
return (
<button
title={l10n.t(LocalizationKey.commonRemoveValue, title)}
className={`metadata_field__choice__button text-left ${className || ""}`}
onClick={() => onClick(value)}
>
<span>{title}</span>
<XMarkIcon className={`metadata_field__choice__button_icon`} />
</button>
);
};