Skip to content

Commit

Permalink
fix: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Jan 21, 2025
1 parent 3884d78 commit c982ae4
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 71 deletions.
24 changes: 16 additions & 8 deletions packages/admin-ui/src/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,50 @@ const alertVariants = cva(
{
type: "info",
variant: "strong",
className: "wby-bg-neutral-dark wby-text-neutral-light [&_a]:!wby-text-neutral-light"
className:
"wby-bg-neutral-dark wby-text-neutral-light [&_a]:!wby-text-neutral-light"
},
{
type: "info",
variant: "subtle",
className: "wby-bg-neutral-dimmed wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
className:
"wby-bg-neutral-dimmed wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
},
{
type: "success",
variant: "strong",
className: "wby-bg-secondary-default wby-text-neutral-light [&_a]:!wby-text-neutral-light"
className:
"wby-bg-secondary-default wby-text-neutral-light [&_a]:!wby-text-neutral-light"
},
{
type: "success",
variant: "subtle",
className: "wby-bg-success-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
className:
"wby-bg-success-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
},
{
type: "warning",
variant: "strong",
className: "wby-bg-warning-default wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
className:
"wby-bg-warning-default wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
},
{
type: "warning",
variant: "subtle",
className: "wby-bg-warning-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
className:
"wby-bg-warning-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
},
{
type: "danger",
variant: "strong",
className: "wby-bg-destructive-default wby-text-neutral-light [&_a]:!wby-text-neutral-light"
className:
"wby-bg-destructive-default wby-text-neutral-light [&_a]:!wby-text-neutral-light"
},
{
type: "danger",
variant: "subtle",
className: "wby-bg-destructive-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
className:
"wby-bg-destructive-subtle wby-text-neutral-primary [&_a]:!wby-text-neutral-primary"
}
]
}
Expand Down
46 changes: 26 additions & 20 deletions packages/admin-ui/src/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ const AvatarFallbackBase = React.forwardRef<
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn("wby-flex wby-h-full wby-w-full wby-items-center wby-justify-center wby-rounded-sm", className)}
className={cn(
"wby-flex wby-h-full wby-w-full wby-items-center wby-justify-center wby-rounded-sm",
className
)}
{...props}
/>
));
Expand All @@ -40,28 +43,31 @@ interface AvatarProps
fallback?: React.ReactElement<AvatarFallbackProps>;
}

const avatarVariants = cva("wby-relative wby-flex wby-shrink-0 wby-overflow-hidden wby-border-sm wby-border-transparent", {
variants: {
size: {
sm: "wby-text-h6 wby-rounded-sm wby-p-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>*]:wby-size-md",
md: "wby-text-h6 wby-rounded-md wby-p-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>*]:wby-size-lg",
lg: "wby-text-h6 wby-rounded-md wby-p-[calc(theme(padding.sm)-theme(borderWidth.sm))] [&>*]:wby-size-lg",
xl: "wby-text-h4 wby-rounded-lg wby-p-[calc(theme(padding.sm)-theme(borderWidth.sm))] [&>*]:wby-size-xl"
const avatarVariants = cva(
"wby-relative wby-flex wby-shrink-0 wby-overflow-hidden wby-border-sm wby-border-transparent",
{
variants: {
size: {
sm: "wby-text-h6 wby-rounded-sm wby-p-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>*]:wby-size-md",
md: "wby-text-h6 wby-rounded-md wby-p-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>*]:wby-size-lg",
lg: "wby-text-h6 wby-rounded-md wby-p-[calc(theme(padding.sm)-theme(borderWidth.sm))] [&>*]:wby-size-lg",
xl: "wby-text-h4 wby-rounded-lg wby-p-[calc(theme(padding.sm)-theme(borderWidth.sm))] [&>*]:wby-size-xl"
},
variant: {
strong: "wby-bg-primary wby-text-neutral-light [&_svg]:wby-fill-neutral-base",
subtle: "wby-bg-neutral-light wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
light: "wby-bg-neutral-dimmed wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
quiet: "wby-bg-transparent wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
outlined:
"wby-bg-neutral-base !wby-border-neutral-muted wby-border-sm wby-text-accent-primary [&_svg]:wby-fill-neutral-xstrong"
}
},
variant: {
strong: "wby-bg-primary wby-text-neutral-light [&_svg]:wby-fill-neutral-base",
subtle: "wby-bg-neutral-light wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
light: "wby-bg-neutral-dimmed wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
quiet: "wby-bg-transparent wby-text-neutral-primary [&_svg]:wby-fill-neutral-xstrong",
outlined:
"wby-bg-neutral-base !wby-border-neutral-muted wby-border-sm wby-text-accent-primary [&_svg]:wby-fill-neutral-xstrong"
defaultVariants: {
size: "md",
variant: "strong"
}
},
defaultVariants: {
size: "md",
variant: "strong"
}
});
);

const AvatarBase = React.forwardRef<React.ElementRef<typeof AvatarPrimitive.Root>, AvatarProps>(
({ image, fallback, className, size, variant, ...props }, ref) => {
Expand Down
24 changes: 16 additions & 8 deletions packages/admin-ui/src/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,14 @@ const buttonVariants = cva(
{
size: "sm",
contentLayout: "text-icon-start",
className: "wby-pl-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs"
className:
"wby-pl-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs"
},
{
size: "sm",
contentLayout: "text-icon-end",
className: "wby-pr-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs"
className:
"wby-pr-[calc(theme(padding.xs)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs"
},
{
size: "md",
Expand All @@ -100,12 +102,14 @@ const buttonVariants = cva(
{
size: "md",
contentLayout: "text-icon-start",
className: "wby-pl-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs"
className:
"wby-pl-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs"
},
{
size: "md",
contentLayout: "text-icon-end",
className: "wby-pr-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs"
className:
"wby-pr-[calc(theme(padding.xs-plus)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs"
},
{
size: "lg",
Expand All @@ -115,12 +119,14 @@ const buttonVariants = cva(
{
size: "lg",
contentLayout: "text-icon-start",
className: "wby-pl-[calc(theme(padding.sm-extra)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs-plus"
className:
"wby-pl-[calc(theme(padding.sm-extra)-theme(borderWidth.sm))] [&>svg]:wby-mr-xs-plus"
},
{
size: "lg",
contentLayout: "text-icon-end",
className: "wby-pr-[calc(theme(padding.sm-extra)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs-plus"
className:
"wby-pr-[calc(theme(padding.sm-extra)-theme(borderWidth.sm))] [&>svg]:wby-ml-xs-plus"
},
{
size: "xl",
Expand All @@ -130,12 +136,14 @@ const buttonVariants = cva(
{
size: "xl",
contentLayout: "text-icon-start",
className: "wby-pl-[calc(theme(padding.sm-extra)-theme(borderWidth.md))] [&>svg]:wby-mr-sm"
className:
"wby-pl-[calc(theme(padding.sm-extra)-theme(borderWidth.md))] [&>svg]:wby-mr-sm"
},
{
size: "xl",
contentLayout: "text-icon-end",
className: "wby-pr-[calc(theme(padding.sm-extra)-theme(borderWidth.md))] [&>svg]:wby-ml-sm"
className:
"wby-pr-[calc(theme(padding.sm-extra)-theme(borderWidth.md))] [&>svg]:wby-ml-sm"
}
],
defaultVariants: {
Expand Down
51 changes: 27 additions & 24 deletions packages/admin-ui/src/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,36 @@ import { Heading } from "~/Heading";
import { Text } from "~/Text";
import { cva, type VariantProps } from "class-variance-authority";

const cardRootVariants = cva("wby-flex wby-flex-col wby-bg-neutral-base wby-gap-y-md-plus wby-text-sm", {
variants: {
padding: {
standard: "wby-p-lg",
comfortable: "wby-p-xl",
compact: "wby-p-md"
const cardRootVariants = cva(
"wby-flex wby-flex-col wby-bg-neutral-base wby-gap-y-md-plus wby-text-sm",
{
variants: {
padding: {
standard: "wby-p-lg",
comfortable: "wby-p-xl",
compact: "wby-p-md"
},
elevation: {
none: "",
xs: "wby-shadow-xs",
sm: "wby-shadow-sm",
md: "wby-shadow-md",
lg: "wby-shadow-lg",
xl: "wby-shadow-xl"
},
borderRadius: {
none: "wby-rounded-none",
sm: "wby-rounded-sm",
md: "wby-rounded-md"
}
},
elevation: {
none: "",
xs: "wby-shadow-xs",
sm: "wby-shadow-sm",
md: "wby-shadow-md",
lg: "wby-shadow-lg",
xl: "wby-shadow-xl"
},
borderRadius: {
none: "wby-rounded-none",
sm: "wby-rounded-sm",
md: "wby-rounded-md"
defaultVariants: {
padding: "standard",
elevation: "none",
borderRadius: "md"
}
},
defaultVariants: {
padding: "standard",
elevation: "none",
borderRadius: "md"
}
});
);

interface CardRootProps
extends Omit<React.HTMLAttributes<HTMLDivElement>, "title">,
Expand Down
4 changes: 3 additions & 1 deletion packages/admin-ui/src/Command/components/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ interface ItemProps

const Item = ({ className, children, selected, ...props }: ItemProps) => (
<CommandPrimitive.Item className={cn(commandItemVariants({ selected }), className)} {...props}>
<span className={"wby-w-full wby-overflow-hidden wby-truncate wby-whitespace-nowrap"}>{children}</span>
<span className={"wby-w-full wby-overflow-hidden wby-truncate wby-whitespace-nowrap"}>
{children}
</span>
{selected ? <Check className="wby-w-md wby-h-md" /> : null}
</CommandPrimitive.Item>
);
Expand Down
4 changes: 3 additions & 1 deletion packages/admin-ui/src/Dialog/components/DialogBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ import type { DialogProps } from "~/Dialog";
export type DialogBodyProps = Pick<DialogProps, "children" | "bodyPadding">;

export const DialogBody = ({ bodyPadding, children }: DialogBodyProps) => {
return <div className={cn("wby-py-sm ", { "wby-px-lg": bodyPadding !== false })}>{children}</div>;
return (
<div className={cn("wby-py-sm ", { "wby-px-lg": bodyPadding !== false })}>{children}</div>
);
};
5 changes: 4 additions & 1 deletion packages/admin-ui/src/Dialog/components/DialogFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ export const DialogFooter = ({ actions, info, className, ...props }: DialogFoote
}

return (
<div {...props} className={cn("wby-flex wby-justify-between wby-p-lg wby-pt-md-extra", className)}>
<div
{...props}
className={cn("wby-flex wby-justify-between wby-p-lg wby-pt-md-extra", className)}
>
{info && (
<div className={"wby-text-sm wby-flex wby-items-center"}>
<div>{info}</div>
Expand Down
5 changes: 4 additions & 1 deletion packages/admin-ui/src/Dialog/components/DialogTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@ import { cn } from "~/utils";
export type DialogTitleProps = React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>;

export const DialogTitle = ({ className, ...props }: DialogTitleProps) => (
<DialogPrimitive.Title {...props} className={cn("wby-text-h4 wby-flex wby-gap-sm", className)} />
<DialogPrimitive.Title
{...props}
className={cn("wby-text-h4 wby-flex wby-gap-sm", className)}
/>
);
7 changes: 6 additions & 1 deletion packages/admin-ui/src/FormComponent/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ const DecoratableFormComponentDescription = (props: FormComponentDescriptionProp
}

return (
<Text text={props.text} size={"sm"} as={"div"} className={"wby-mb-sm wby-text-neutral-strong"} />
<Text
text={props.text}
size={"sm"}
as={"div"}
className={"wby-mb-sm wby-text-neutral-strong"}
/>
);
};

Expand Down
7 changes: 6 additions & 1 deletion packages/admin-ui/src/FormComponent/Note.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ const DecoratableFormComponentNote = (props: FormComponentNoteProps) => {
}

return (
<Text text={props.text} size={"sm"} as={"div"} className={"wby-mt-sm wby-text-neutral-strong"} />
<Text
text={props.text}
size={"sm"}
as={"div"}
className={"wby-mt-sm wby-text-neutral-strong"}
/>
);
};

Expand Down
5 changes: 4 additions & 1 deletion packages/admin-ui/src/Grid/stories/StyledColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export interface StyledColumnProps extends ColumnProps {
}

export const StyledColumn = (props: StyledColumnProps) => (
<Grid.Column className="wby-bg-primary wby-text-neutral-light wby-p-2 wby-text-md wby-rounded-sm" {...props}>
<Grid.Column
className="wby-bg-primary wby-text-neutral-light wby-p-2 wby-text-md wby-rounded-sm"
{...props}
>
Col {props.index}
{props.span && (
<>
Expand Down
4 changes: 3 additions & 1 deletion packages/admin-ui/src/Select/SelectPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ const DecoratableSelectLabel = React.forwardRef<
<SelectPrimitives.Label
ref={ref}
className={cn(
["wby-py-sm wby-px-md wby-text-neutral-strong wby-text-sm wby-font-semibold wby-uppercase"],
[
"wby-py-sm wby-px-md wby-text-neutral-strong wby-text-sm wby-font-semibold wby-uppercase"
],
className
)}
{...props}
Expand Down
5 changes: 4 additions & 1 deletion packages/admin-ui/src/Slider/SliderPrimitive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ const SliderPrimitiveTrack = makeDecoratable(
* Slider Tooltip
*/
const sliderTooltipVariants = cva(
["wby-px-xs-plus wby-py-xxs wby-rounded-sm wby-absolute wby-left-1/2 wby-translate-x-1/2", "wby-bg-neutral-muted"],
[
"wby-px-xs-plus wby-py-xxs wby-rounded-sm wby-absolute wby-left-1/2 wby-translate-x-1/2",
"wby-bg-neutral-muted"
],
{
variants: {
side: {
Expand Down
4 changes: 3 additions & 1 deletion packages/admin-ui/src/Tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ const DecoratableTag = ({
)}
aria-disabled={disabled}
>
<span className={"wby-overflow-hidden wby-truncate wby-whitespace-nowrap"}>{content}</span>
<span className={"wby-overflow-hidden wby-truncate wby-whitespace-nowrap"}>
{content}
</span>
{onDismiss && (
<IconButton
icon={<Icon icon={dismissIconElement} label={dismissIconLabel} size={"sm"} />}
Expand Down
6 changes: 5 additions & 1 deletion packages/admin-ui/src/Toast/Toast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ const DecoratableToastActions = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ children, ...props }, ref) => (
<div {...props} className={"wby-mt-md wby-flex wby-w-full wby-items-center wby-justify-start wby-gap-sm"} ref={ref}>
<div
{...props}
className={"wby-mt-md wby-flex wby-w-full wby-items-center wby-justify-start wby-gap-sm"}
ref={ref}
>
{children}
</div>
));
Expand Down

0 comments on commit c982ae4

Please sign in to comment.