mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 04:14:38 +00:00
Feat: added tag color widgt and changed tag popover design
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user