Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:update styles #747

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const AccordionItem = (props: AccordionItemProps) => {
value={value}
className={twMerge(
cx(
'w-full overflow-hidden text-gray-900 dark:text-white dark:bg-gray-800 border-b last:border-b-0', // border bottom on each header trigger except last
'w-full overflow-hidden text-gray-900 dark:text-white bg-gray-100 dark:bg-gray-800 border-b last:border-b-0', // border bottom on each header trigger except last
'border-gray-200 dark:border-gray-700 dark:border-opacity-50',
className,
),
Expand Down Expand Up @@ -83,7 +83,7 @@ export const AccordionContent = React.forwardRef<
>(({ children, className, ...props }, forwardedRef) => (
<AccordionPrimitive.Content
className={cx(
'bg-white dark:bg-gray-900 w-full text-gray-500 dark:text-gray-400 leading-[150%]',
'bg-white dark:bg-gray-900 w-full text-gray-500 dark:text-gray-400 leading-6',
'radix-state-open:border-t dark:radix-state-open:border-gray-700 dark:radix-state-open:border-opacity-50', // border top of its content
'radix-state-open:animate-accordion-open',
'radix-state-closed:animate-accordion-closed',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const MediumDanger = Template.bind({});
MediumDanger.args = {
label: 'Badge sm',
color: 'danger',
sizing: 'md',
size: 'lg',
};

export const WithCloseAction = () => {
Expand Down Expand Up @@ -79,7 +79,7 @@ export const WithCloseAction = () => {
id={id}
value={value}
color={value as ColorType}
sizing="md"
size="lg"
icon={<HiInformationCircle />}
isRemove={true}
onRemove={(badge) => {
Expand Down Expand Up @@ -118,7 +118,7 @@ export const CustomColor = () => {
id={id}
value={value}
color={value as ColorType}
sizing="md"
size="lg"
icon={<HiInformationCircle />}
isRemove={true}
className={'bg-lime-700 text-teal-300'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { twMerge } from 'tailwind-merge';

import { Typography } from '@/components/typography/Typography';

export type SizeType = 'sm' | 'md';
export type SizeType = 'sm' | 'lg';
export type ColorType = 'default' | 'primary' | 'success' | 'danger';
export type SelectedBadgeProps = {
id: string | number | undefined;
Expand All @@ -16,7 +16,7 @@ export type SelectedBadgeProps = {
export interface BadgeProps extends Omit<ComponentProps<'span'>, 'ref' | 'color'> {
label?: string;
value?: string;
sizing?: SizeType;
size?: SizeType;
color?: ColorType;
icon?: React.ReactNode;
isRemove?: boolean;
Expand All @@ -32,11 +32,11 @@ const classes = {
},
size: {
sm: `${Typography.size.sm} py-0.5 px-2.5`,
md: `${Typography.size.base} py-0.5 px-3`,
lg: `${Typography.size.base} py-0.5 px-3`,
},
icon: {
sm: 'w-3.5 h-3.5',
md: 'w-4 h-4',
lg: 'w-4 h-4',
},
};

Expand All @@ -47,7 +47,7 @@ export const Badge = forwardRef<HTMLLabelElement, BadgeProps>(
value,
id,
icon,
sizing = 'sm',
size = 'sm',
color = 'default',
className,
onRemove,
Expand All @@ -65,7 +65,7 @@ export const Badge = forwardRef<HTMLLabelElement, BadgeProps>(
className={twMerge(
cx(
`${Typography.weight.normal} inline-flex gap-1.5 justify-center items-center rounded-md text-gray-900 dark:text-white`,
`${classes.size[sizing]}`,
`${classes.size[size]}`,
`${classes.color[color]}`,
),
className,
Expand All @@ -76,7 +76,7 @@ export const Badge = forwardRef<HTMLLabelElement, BadgeProps>(
{icon && (
<IconContext.Provider
value={{
className: cx(`${classes.icon[sizing]}`),
className: cx(`${classes.icon[size]}`),
}}
>
{icon}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export const Card = (props: CardType) => {
<div
className={twMerge(
cx(
`inline-flex flex-col rounded-lg overflow-hidden outline-none border border-gray-200 dark:border-gray-700
`rounded-lg overflow-hidden outline-none border border-gray-200 dark:border-gray-700
bg-white shadow-[0px_4px_6px_-1px_rgba(0,_0,_0,_0.01),_0px_2px+4px_-2px_rgba(0,_0,_0,_0.05)]
dark:bg-gray-800 dark:shadow-[0px_4px_6px_-1px_rgba(0,_0,_0,_0.01),_0px_2px+4px_-2px_rgba(0,_0,_0,_0.05)]
${props.className}`,
text-gray-900 dark:text-white`,
),
className,
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ export const Checkbox: React.FC<CheckboxProps> = (props) => {
<LabelPrimitive.Label
htmlFor={_id}
className={cx(
Typography.size.xs,
Typography.weight.normal,
'ml-2 text-gray-500 dark:text-gray-400 cursor-default',
Typography.size.sm,
Typography.weight.medium,
'ml-2 text-gray-600 dark:text-gray-300 cursor-default',
)}
>
{label}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface SelectProps<T extends Value = Value> {
color?: ColorType;
helperText?: string;
placeholder?: string;
className?: string;
}

type IconProps = {
Expand Down Expand Up @@ -131,6 +132,7 @@ export function Select<T extends Value>({
color = COLOR_DEFAULT,
placeholder,
startIcon,
className = '',
}: SelectProps<T>) {
const select = useSelectState<T>({
defaultValue: defaultValue ?? ((Array.isArray(value) ? [] : '') as T),
Expand Down Expand Up @@ -167,19 +169,22 @@ export function Select<T extends Value>({
<AriaKitSelect
state={select}
name={name}
className={cx(
'w-full border box-border rounded-lg bg-gray-50 dark:bg-gray-700',
'block text-left relative',
'focus:outline-none select-none overscroll-contain',
`${classes.color[color]}`,
`${classes.size[sizing]}`,
`${Typography.weight.normal}`,
`${Typography.leading.none}`,
{
'pl-[38px]': startIcon,
'h-[42px]': sizing === 'sm',
'h-[52px]': sizing === 'md',
},
className={twMerge(
cx(
'w-full border box-border rounded-lg bg-gray-50 dark:bg-gray-700',
'block text-left relative',
'focus:outline-none select-none overscroll-contain',
`${classes.color[color]}`,
`${classes.size[sizing]}`,
`${Typography.weight.normal}`,
`${Typography.leading.none}`,
{
'pl-[38px]': startIcon,
'h-[42px]': sizing === 'sm',
'h-[52px]': sizing === 'md',
},
className,
),
)}
data-testid={`ariakit-select-${name}`}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { twMerge } from 'tailwind-merge';
type SeparatorProps = {
className?: string;
};
const Separator: FC<SeparatorProps> = ({ className = '' }) => (
const Separator: FC<SeparatorProps> = ({
className = 'bg-gray-100 dark:bg-gray-700 h-px',
}) => (
<SeparatorPrimitive.Root className={twMerge(cx(className))}></SeparatorPrimitive.Root>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as SwitchPrimitive from '@radix-ui/react-switch';
import cx from 'classnames';
import { useId } from 'react';

import { Typography } from '@/main';

export type SwitchProps = SwitchPrimitive.SwitchProps & {
label?: string;
};
Expand Down Expand Up @@ -41,7 +43,8 @@ const Switch = (props: SwitchProps) => {
<LabelPrimitive.Label
htmlFor={_id}
className={cx(
'pl-2 text-xs font-normal text-gray-500 dark:text-gray-400 cursor-default',
'pl-2 font-normal text-gray-600 dark:text-gray-300 cursor-default',
`${Typography.size.sm} ${Typography.weight.medium}`,
{
'cursor-not-allowed': disabled,
},
Expand Down
1 change: 1 addition & 0 deletions deepfence_frontend/packages/ui-components/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export {
AccordionTrigger,
} from '@/components/accordion/Accordion';
export { Avatar } from '@/components/avatar/Avatar';
export { Badge } from '@/components/badge/Badge';
export { Breadcrumb, BreadcrumbLink } from '@/components/breadcrumb/Breadcrumb';
export { default as Button } from '@/components/button/Button';
export { default as IconButton } from '@/components/button/IconButton';
Expand Down