Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
indaviande committed Dec 17, 2024
1 parent ab182d6 commit e0128af
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 64 deletions.
30 changes: 6 additions & 24 deletions src/components/primitives/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const buttonStyles = tv(
size: "md",
},
},
{ twMerge: false }
{ twMerge: false },
);

type ButtonStyleProps = VariantProps<typeof buttonStyles>;
Expand Down Expand Up @@ -70,13 +70,7 @@ export default function Button({
target="_blank"
rel="noopener noreferrer"
onClick={() => window.open(to, "_blank", "noopener noreferrer")}
className={mergeClass(
styleProps,
styleBold,
className,
disabled && "disabled"
)}
>
className={mergeClass(styleProps, styleBold, className, disabled && "disabled")}>
{children}
</a>
);
Expand All @@ -87,17 +81,11 @@ export default function Button({
<Link
prefetch="intent"
to={to}
className={mergeClass(
styleProps,
styleBold,
className,
disabled && "disabled"
)}
className={mergeClass(styleProps, styleBold, className, disabled && "disabled")}
{...(external && {
target: "_blank",
rel: "noopener noreferrer",
})}
>
})}>
{children}
</Link>
</EventBlocker>
Expand All @@ -107,16 +95,10 @@ export default function Button({
return (
<button
style={themeVars}
className={mergeClass(
styleProps,
styleBold,
className,
disabled && "disabled"
)}
className={mergeClass(styleProps, styleBold, className, disabled && "disabled")}
type="button"
disabled={disabled}
{...props}
>
{...props}>
{children}
</button>
);
Expand Down
34 changes: 6 additions & 28 deletions src/components/primitives/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ export const textStyles = tv(
md: "text-base",
lg: "text-lg",
xl: "text-xl",
display1:
"font-title font-bold leading-tight italic uppercase !text-[clamp(44px,5vw+0.875rem,104px)]",
display1: "font-title font-bold leading-tight italic uppercase !text-[clamp(44px,5vw+0.875rem,104px)]",
1: "font-title font-bold italic leading-none !text-[clamp(44px,4.333vw+1.125rem,96px)]",
2: "font-title font-bold leading-none italic !text-[clamp(38px,0.667vw+2.125rem,46px)]",
3: "font-title font-bold leading-none italic !text-[clamp(26px,0.667vw+1.375rem,34px)]",
Expand All @@ -39,8 +38,7 @@ export const textStyles = tv(
md: "text-base",
lg: "text-lg",
xl: "text-xl",
display1:
"font-title font-bold leading-tight italic uppercase !text-[clamp(44px,5vw+0.875rem,104px)]",
display1: "font-title font-bold leading-tight italic uppercase !text-[clamp(44px,5vw+0.875rem,104px)]",
1: "font-title !text-3xl",
2: "font-title font-bold leading-none italic !text-[clamp(38px,0.667vw+2.125rem,46px)]",
3: "font-title font-bold leading-none italic !text-[clamp(26px,0.667vw+1.375rem,34px)]",
Expand All @@ -53,32 +51,12 @@ export const textStyles = tv(
false: "",
},
},
{ twMerge: false }
{ twMerge: false },
);

export type TextProps = Component<
Styled<typeof textStyles> & { bold?: boolean },
HTMLParagraphElement
>;
export type TextProps = Component<Styled<typeof textStyles> & { bold?: boolean }, HTMLParagraphElement>;

export default function Text({
look,
size,
style,
bold,
interactable,
className,
...props
}: TextProps) {
export default function Text({ look, size, style, bold, interactable, className, ...props }: TextProps) {
const styleBold = bold ? "font-bold" : "";
return (
<p
className={mergeClass(
textStyles({ look, size, interactable }),
styleBold,
className
)}
{...props}
/>
);
return <p className={mergeClass(textStyles({ look, size, interactable }), styleBold, className)} {...props} />;
}
48 changes: 41 additions & 7 deletions src/components/primitives/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import clsx from "clsx";
import { forwardRef } from "react";
import { tv } from "tailwind-variants";
import type { Component, Styled } from "../../utils/types";
Expand Down Expand Up @@ -35,21 +34,56 @@ export type TitleProps = Component<

const Title = forwardRef<HTMLHeadingElement, TitleProps>(function Title(
{ look, h, size: _size, className, ...props }: TitleProps,
ref,
ref
) {
const size = _size ?? h;

switch (h) {
case 1:
return <h1 ref={ref} className={clsx(titleStyles({ look, size }), className)} children={" "} {...props} />;
return (
<h1
ref={ref}
className={mergeClass(titleStyles({ look, size }), className)}
children={" "}
{...props}
/>
);
case 2:
return <h2 ref={ref} className={clsx(titleStyles({ look, size }), className)} children={" "} {...props} />;
return (
<h2
ref={ref}
className={mergeClass(titleStyles({ look, size }), className)}
children={" "}
{...props}
/>
);
case 3:
return <h3 ref={ref} className={clsx(titleStyles({ look, size }), className)} children={" "} {...props} />;
return (
<h3
ref={ref}
className={mergeClass(titleStyles({ look, size }), className)}
children={" "}
{...props}
/>
);
case 4:
return <h4 ref={ref} className={clsx(titleStyles({ look, size }), className)} children={" "} {...props} />;
return (
<h4
ref={ref}
className={mergeClass(titleStyles({ look, size }), className)}
children={" "}
{...props}
/>
);
case 5:
return <h5 ref={ref} className={clsx(titleStyles({ look, size }), className)} children={" "} {...props} />;
return (
<h5
ref={ref}
className={mergeClass(titleStyles({ look, size }), className)}
children={" "}
{...props}
/>
);
default:
break;
}
Expand Down
10 changes: 5 additions & 5 deletions src/theming/coloring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,17 @@ export function extractColorScale(theme: Coloring) {
const extract = ({ accentScale: accent, grayScale: main, background }: typeof darkOutput | typeof lightOutput) => {
// Convert background color to RGB components
const getRGB = (color: string) => {
const hex = color.replace('#', '');
const r = parseInt(hex.substring(0, 2), 16);
const g = parseInt(hex.substring(2, 4), 16);
const b = parseInt(hex.substring(4, 6), 16);
const hex = color.replace("#", "");
const r = Number.parseInt(hex.substring(0, 2), 16);
const g = Number.parseInt(hex.substring(2, 4), 16);
const b = Number.parseInt(hex.substring(4, 6), 16);
return `${r} ${g} ${b}`;
};

return {
accent,
main,
background: getRGB(background)
background: getRGB(background),
};
};

Expand Down

0 comments on commit e0128af

Please sign in to comment.