mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 13:27:22 +00:00
feat(ui): components changes for new org settings page
This commit is contained in:
@@ -3,14 +3,19 @@ import { twMerge } from 'tailwind-merge';
|
|||||||
|
|
||||||
export type CardTitleProps = {
|
export type CardTitleProps = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
subTitle?: string;
|
subTitle?: ReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const CardTitle = ({ children, className, subTitle }: CardTitleProps) => (
|
export const CardTitle = ({ children, className, subTitle }: CardTitleProps) => (
|
||||||
<div className={twMerge('px-6 py-4 mb-5 font-sans text-lg font-normal border-b border-mineshaft-600', className)}>
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
'px-6 py-4 mb-5 font-sans text-lg font-normal border-b border-mineshaft-600',
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
{subTitle && <p className="pt-0.5 text-sm font-normal text-gray-400">{subTitle}</p>}
|
{subTitle && <p className="pt-2 text-sm font-normal text-gray-400">{subTitle}</p>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useToggle } from '@app/hooks';
|
|||||||
import { Button } from '../Button';
|
import { Button } from '../Button';
|
||||||
import { FormControl } from '../FormControl';
|
import { FormControl } from '../FormControl';
|
||||||
import { Input } from '../Input';
|
import { Input } from '../Input';
|
||||||
import { Modal, ModalContent } from '../Modal';
|
import { Modal, ModalClose, ModalContent } from '../Modal';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
isOpen?: boolean;
|
isOpen?: boolean;
|
||||||
@@ -64,9 +64,11 @@ export const DeleteActionModal = ({
|
|||||||
>
|
>
|
||||||
Delete
|
Delete
|
||||||
</Button>
|
</Button>
|
||||||
<Button variant="plain" colorSchema="secondary" onClick={onClose}>
|
<ModalClose asChild>
|
||||||
Cancel
|
<Button variant="plain" colorSchema="secondary" onClick={onClose}>
|
||||||
</Button>
|
Cancel
|
||||||
|
</Button>
|
||||||
|
</ModalClose>{' '}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
|
|||||||
@@ -84,19 +84,19 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|||||||
): JSX.Element => {
|
): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<div className={inputParentContainerVariants({ isRounded, isError, isFullWidth, variant })}>
|
<div className={inputParentContainerVariants({ isRounded, isError, isFullWidth, variant })}>
|
||||||
{leftIcon && <span className="absolute left-0 ml-2">{leftIcon}</span>}
|
{leftIcon && <span className="absolute left-0 ml-3">{leftIcon}</span>}
|
||||||
<input
|
<input
|
||||||
{...props}
|
{...props}
|
||||||
required={isRequired}
|
required={isRequired}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
disabled={isDisabled}
|
disabled={isDisabled}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
leftIcon ? 'pl-9' : 'pl-2.5',
|
leftIcon ? 'pl-10' : 'pl-2.5',
|
||||||
rightIcon ? 'pr-9' : 'pr-2.5',
|
rightIcon ? 'pr-10' : 'pr-2.5',
|
||||||
inputVariants({ className, isError, size, isRounded, variant })
|
inputVariants({ className, isError, size, isRounded, variant })
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
{rightIcon && <span className="absolute right-0 mr-2">{rightIcon}</span>}
|
{rightIcon && <span className="absolute right-0 mr-3">{rightIcon}</span>}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { IconButton } from '../IconButton';
|
|||||||
|
|
||||||
export type ModalContentProps = DialogPrimitive.DialogContentProps & {
|
export type ModalContentProps = DialogPrimitive.DialogContentProps & {
|
||||||
title?: ReactNode;
|
title?: ReactNode;
|
||||||
subTitle?: string;
|
subTitle?: ReactNode;
|
||||||
footerContent?: ReactNode;
|
footerContent?: ReactNode;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,18 +14,28 @@ type Props = {
|
|||||||
dropdownContainerClassName?: string;
|
dropdownContainerClassName?: string;
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
position?: 'item-aligned' | 'popper';
|
position?: 'item-aligned' | 'popper';
|
||||||
|
isDisabled?: boolean;
|
||||||
icon?: IconProp;
|
icon?: IconProp;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type SelectProps = SelectPrimitive.SelectProps & Props;
|
export type SelectProps = Omit<SelectPrimitive.SelectProps, 'disabled'> & Props;
|
||||||
|
|
||||||
export const Select = forwardRef<HTMLButtonElement, SelectProps>(
|
export const Select = forwardRef<HTMLButtonElement, SelectProps>(
|
||||||
(
|
(
|
||||||
{ children, placeholder, className, isLoading, dropdownContainerClassName, position, ...props },
|
{
|
||||||
|
children,
|
||||||
|
placeholder,
|
||||||
|
className,
|
||||||
|
isLoading,
|
||||||
|
isDisabled,
|
||||||
|
dropdownContainerClassName,
|
||||||
|
position,
|
||||||
|
...props
|
||||||
|
},
|
||||||
ref
|
ref
|
||||||
): JSX.Element => {
|
): JSX.Element => {
|
||||||
return (
|
return (
|
||||||
<SelectPrimitive.Root {...props}>
|
<SelectPrimitive.Root {...props} disabled={isDisabled}>
|
||||||
<SelectPrimitive.Trigger
|
<SelectPrimitive.Trigger
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
@@ -37,7 +47,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(
|
|||||||
<SelectPrimitive.Value placeholder={placeholder}>
|
<SelectPrimitive.Value placeholder={placeholder}>
|
||||||
{props.icon ? <FontAwesomeIcon icon={props.icon} /> : placeholder}
|
{props.icon ? <FontAwesomeIcon icon={props.icon} /> : placeholder}
|
||||||
</SelectPrimitive.Value>
|
</SelectPrimitive.Value>
|
||||||
{!props.disabled && (
|
{!isDisabled && (
|
||||||
<SelectPrimitive.Icon className="ml-3">
|
<SelectPrimitive.Icon className="ml-3">
|
||||||
<FontAwesomeIcon icon={faChevronDown} size="sm" />
|
<FontAwesomeIcon icon={faChevronDown} size="sm" />
|
||||||
</SelectPrimitive.Icon>
|
</SelectPrimitive.Icon>
|
||||||
@@ -46,7 +56,7 @@ export const Select = forwardRef<HTMLButtonElement, SelectProps>(
|
|||||||
<SelectPrimitive.Portal>
|
<SelectPrimitive.Portal>
|
||||||
<SelectPrimitive.Content
|
<SelectPrimitive.Content
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
'relative top-1 overflow-hidden rounded-md bg-bunker-800 font-inter text-bunker-100 shadow-md z-[100]',
|
'relative top-1 z-[100] overflow-hidden rounded-md bg-bunker-800 font-inter text-bunker-100 shadow-md',
|
||||||
dropdownContainerClassName
|
dropdownContainerClassName
|
||||||
)}
|
)}
|
||||||
position={position}
|
position={position}
|
||||||
@@ -89,11 +99,12 @@ export const SelectItem = forwardRef<HTMLDivElement, SelectItemProps>(
|
|||||||
<SelectPrimitive.Item
|
<SelectPrimitive.Item
|
||||||
{...props}
|
{...props}
|
||||||
className={twMerge(
|
className={twMerge(
|
||||||
`relative flex cursor-pointer
|
`relative mb-0.5 flex
|
||||||
select-none items-center rounded-md py-2 pl-10 pr-4 mb-0.5 text-sm
|
cursor-pointer select-none items-center rounded-md py-2 pl-10 pr-4 text-sm
|
||||||
outline-none transition-all hover:bg-mineshaft-500`,
|
outline-none transition-all hover:bg-mineshaft-500`,
|
||||||
isSelected && 'bg-primary',
|
isSelected && 'bg-primary',
|
||||||
isDisabled && 'cursor-not-allowed text-gray-600 hover:bg-transparent hover:text-mineshaft-600',
|
isDisabled &&
|
||||||
|
'cursor-not-allowed text-gray-600 hover:bg-transparent hover:text-mineshaft-600',
|
||||||
className
|
className
|
||||||
)}
|
)}
|
||||||
ref={forwardedRef}
|
ref={forwardedRef}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { ReactNode } from 'react';
|
||||||
|
import { cva, VariantProps } from 'cva';
|
||||||
|
import { twMerge } from 'tailwind-merge';
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
children: ReactNode;
|
||||||
|
className?: string;
|
||||||
|
} & VariantProps<typeof tagVariants>;
|
||||||
|
|
||||||
|
const tagVariants = cva('inline-flex whitespace-nowrap text-sm rounded-md mx-1 text-bunker-200 ', {
|
||||||
|
variants: {
|
||||||
|
colorSchema: {
|
||||||
|
gray: 'bg-mineshaft-500',
|
||||||
|
red: 'bg-red/80 text-bunker-100'
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
sm: 'px-2 py-1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export const Tag = ({ children, className, colorSchema = 'gray', size = 'sm' }: Props) => (
|
||||||
|
<div className={twMerge(tagVariants({ colorSchema, className, size }))}>{children}</div>
|
||||||
|
);
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export { Tag } from './Tag';
|
||||||
@@ -12,5 +12,6 @@ export * from './Select';
|
|||||||
export * from './Spinner';
|
export * from './Spinner';
|
||||||
export * from './Switch';
|
export * from './Switch';
|
||||||
export * from './Table';
|
export * from './Table';
|
||||||
|
export * from './Tag';
|
||||||
export * from './TextArea';
|
export * from './TextArea';
|
||||||
export * from './UpgradePlanModal';
|
export * from './UpgradePlanModal';
|
||||||
|
|||||||
Reference in New Issue
Block a user