mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import * as React from 'react';
|
|
import { CheckCircleIcon, PlusCircleIcon } from '@heroicons/react/24/outline';
|
|
import { CheckCircleIcon as CheckCircleIconSolid, PlusCircleIcon as PlusCircleIconSolid } from '@heroicons/react/24/solid';
|
|
|
|
export interface ISelectItemProps {
|
|
title: string;
|
|
buttonTitle: string;
|
|
isSelected: boolean;
|
|
disabled?: boolean;
|
|
onClick: () => void;
|
|
}
|
|
|
|
export const SelectItem: React.FunctionComponent<ISelectItemProps> = ({
|
|
title,
|
|
buttonTitle,
|
|
isSelected,
|
|
disabled,
|
|
onClick
|
|
}: React.PropsWithChildren<ISelectItemProps>) => {
|
|
return (
|
|
<div
|
|
className={`text-sm flex items-center ${isSelected ? 'text-[var(--vscode-textLink-foreground)]' : 'text-[var(--frontmatter-text)]'}`}
|
|
>
|
|
<button
|
|
onClick={onClick}
|
|
className={`mr-2 flex gap-2 items-center hover:text-[var(--vscode-textLink-activeForeground)] disabled:cursor-not-allowed`}
|
|
title={buttonTitle}
|
|
disabled={disabled}
|
|
>
|
|
{isSelected ? (
|
|
<CheckCircleIconSolid className={`h-4 w-4`} />
|
|
) : (
|
|
<PlusCircleIcon className={`h-4 w-4`} />
|
|
)}
|
|
<span>{title}</span>
|
|
</button>
|
|
</div>
|
|
);
|
|
}; |