Feat: added tag color widgt and changed tag popover design

This commit is contained in:
Ebezer Igbinoba
2023-08-22 05:12:23 +01:00
parent 66ea3ba172
commit 9a1b453c86
14 changed files with 368 additions and 135 deletions
@@ -0,0 +1,5 @@
export const isValidHexColor = (hexColor: string) => {
const hexColorPattern = /^#?([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;
return hexColorPattern.test(hexColor);
}
+2 -12
View File
@@ -11,10 +11,11 @@ type Props = {
color?: string;
styles?: Record<string, string>
isDisabled?: boolean;
tagColor: string;
} & VariantProps<typeof tagVariants>;
const tagVariants = cva(
"inline-flex items-center whitespace-nowrap text-sm rounded-sm mr-1.5 text-bunker-200",
"inline-flex items-center whitespace-nowrap text-sm rounded-sm mr-1.5 text-bunker-200 rounded-[30px] text-gray-400 ",
{
variants: {
colorSchema: {
@@ -41,18 +42,7 @@ export const Tag = ({
}: Props) => (
<div
className={twMerge(tagVariants({ colorSchema, className, size }))}
style={{ backgroundColor: color, ...styles }}
>
{children}
{onClose && (
<button
type="button"
onClick={onClose}
disabled={isDisabled}
className="ml-2 flex items-center justify-center"
>
<FontAwesomeIcon icon={faClose} />
</button>
)}
</div>
);