Skip to content

Commit

Permalink
Apply Biome lints and sort tailwind classes
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasOe committed Oct 10, 2024
1 parent 76dd2fc commit db2afe5
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 40 deletions.
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"singleQuote": false,
"trailingComma": "es5",
"singleAttributePerLine": false,
"endOfLine": "lf"
"endOfLine": "lf",
"plugins": ["prettier-plugin-tailwindcss"]
}
2 changes: 1 addition & 1 deletion src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type FooterProps = React.ComponentProps<"div">;

export default function Footer({ className, ...rest }: FooterProps) {
return (
<div className={twMerge("not-prose p-6 flex w-full justify-center", className)} {...rest}>
<div className={twMerge("not-prose flex w-full justify-center p-6", className)} {...rest}>
<HashLink to="/privacy#" className="focus rounded-sm px-2 text-neutral-500 no-underline">
Privacy Policy
</HashLink>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function Hero({ className, ...rest }: HeroProps) {
return (
<div
className={twMerge(
"select-none text-[7vw] text-neutral-50 leading-normal md:text-[4rem] lg:text-[5rem]",
"select-none text-[7vw] leading-normal text-neutral-50 md:text-[4rem] lg:text-[5rem]",
className
)}
{...rest}
Expand All @@ -30,7 +30,7 @@ export default function Hero({ className, ...rest }: HeroProps) {
]}
wrapper="span"
cursor={true}
repeat={Infinity}
repeat={Number.POSITIVE_INFINITY}
speed={1}
deletionSpeed={20}
className="inline-block bg-accent-violet bg-gradient-to-bl from-accent-pink bg-cover bg-clip-text text-transparent after:text-neutral-50"
Expand Down
2 changes: 1 addition & 1 deletion src/components/LinkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function LinkButton({ text, to, className, ...rest }: LinkButtonP
<HashLink
to={to}
className={twMerge(
"not-prose focus inline-block rounded-lg bg-neutral-300 p-1 hover:bg-neutral-100 text-neutral-900 font-medium px-5 no-underline outline-none",
"not-prose focus inline-block rounded-lg bg-neutral-300 p-1 px-5 font-medium text-neutral-900 no-underline outline-none hover:bg-neutral-100",
className
)}
{...rest}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LinkIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from "react";
import type { ReactNode } from "react";
import { IconContext } from "react-icons";
import { twMerge } from "tailwind-merge";

Expand Down
26 changes: 10 additions & 16 deletions src/components/Navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AnimatePresence, motion } from "framer-motion";
import { useEffect, useState } from "react";
import { useState } from "react";
import { IconContext } from "react-icons";
import { twMerge } from "tailwind-merge";

Expand All @@ -21,17 +21,11 @@ export default function Navbar({ links, socials, className, ...rest }: NavbarPro
const [navbarOpen, setNavbarOpen] = useState(false);
const closeNavbar = () => setNavbarOpen(false);

useEffect(() => {
window.addEventListener("resize", closeNavbar);
window.addEventListener("scroll", closeNavbar);
return () => {
window.removeEventListener("resize", closeNavbar);
window.removeEventListener("scroll", closeNavbar);
};
}, []);
window.addEventListener("resize", closeNavbar);
window.addEventListener("scroll", closeNavbar);

return (
<div className={twMerge("not-prose p-6 w-full", className)} {...rest}>
<div className={twMerge("not-prose w-full p-6", className)} {...rest}>
<div className="flex h-8 items-center justify-between">
{/* Hamburger Menu */}
<div className="h-full md:hidden">
Expand All @@ -49,15 +43,15 @@ export default function Navbar({ links, socials, className, ...rest }: NavbarPro
{/* Site Links */}
<div className="hidden md:block">
<div className="flex flex-wrap gap-x-4">
{links.map((link, index) => (
<NavbarLink key={index} text={link.text} to={link.to} slashes />
{links.map((link) => (
<NavbarLink key={link.to} text={link.text} to={link.to} slashes />
))}
</div>
</div>
{/* Social Links */}
<div className="flex flex-wrap gap-x-4">
{socials.map((social, index) => (
<NavbarLink key={index} text={social.text} to={social.to} newtab />
{socials.map((social) => (
<NavbarLink key={social.to} text={social.text} to={social.to} newtab />
))}
</div>
</div>
Expand All @@ -84,9 +78,9 @@ export default function Navbar({ links, socials, className, ...rest }: NavbarPro
},
}}
>
{links.map((link, index) => (
{links.map((link) => (
<motion.div
key={index}
key={link.to}
variants={{
open: { opacity: 1, x: 0 },
closed: { opacity: 0, x: -10 },
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/NavbarLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default function NavbarLink({ text, to, slashes, newtab, className, ...re
smooth
target={newtab ? "_blank" : "_self"}
rel="noreferrer"
className={twMerge("focus rounded-sm no-underline outline-none px-2", className)}
className={twMerge("focus rounded-sm px-2 no-underline outline-none", className)}
{...rest}
>
<span className="font-mono font-semibold hover:bg-accent-violet hover:bg-gradient-to-bl hover:from-accent-pink hover:bg-cover hover:bg-clip-text hover:text-transparent">{`${
Expand Down
2 changes: 1 addition & 1 deletion src/components/ScrollIndicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HashLink } from "react-router-hash-link";

import useMousePosition from "@/hooks/useMousePosition";
import { getRelativeMousePos } from "@/utils/utils";
import { ElementRef, useRef } from "react";
import { useRef, type ElementRef } from "react";
import { BsArrowDownShort } from "react-icons/bs";

export type ScrollIndicatorProps = React.ComponentProps<"div"> & {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Skill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function Skill({ children, title, icon, className, ...rest }: Ski
scale={0.95}
glareColor="#f472b6"
className={twMerge(
"pointer-events-none w-full rounded-lg bg-secondary p-5 transform-style-3d backface-hidden md:pointer-events-auto flex flex-col",
"pointer-events-none flex w-full flex-col rounded-lg bg-secondary p-5 transform-style-3d backface-hidden md:pointer-events-auto",
className
)}
{...rest}
Expand Down
6 changes: 3 additions & 3 deletions src/components/Timeline/Timeline.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ElementRef, useRef } from "react";
import { useRef, type ElementRef } from "react";
import { twMerge } from "tailwind-merge";

import TimelineProject, { TimelineProjectProps } from "@/components/Timeline/TimelineProject";
import TimelineProject, { type TimelineProjectProps } from "@/components/Timeline/TimelineProject";
import useOffset from "@/hooks/useOffset";
import { clamp, lerp, negativeValues } from "@/utils/math";

Expand Down Expand Up @@ -37,7 +37,7 @@ export default function Timeline({ projects, className, ...rest }: TimelineProps
projectOffsets[index] = useOffset(scrollbarRef, projectRef);
projectTimes[index] = props.time;

return <TimelineProject key={index} {...props} ref={projectRef} />;
return <TimelineProject key={props.title} {...props} ref={projectRef} />;
})}
</div>
<div className="relative hidden sm:flex">
Expand Down
10 changes: 5 additions & 5 deletions src/components/Timeline/TimelineProject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { forwardRef } from "react";
import Markdown from "react-markdown";
import { twMerge } from "tailwind-merge";

import LinkIcon, { LinkIconProps } from "@/components/LinkIcon";
import LinkIcon, { type LinkIconProps } from "@/components/LinkIcon";
import TimelineLabel from "@/components/Timeline/TimelineLabel";

export type TimelineProjectProps = React.ComponentProps<typeof motion.div> & {
Expand Down Expand Up @@ -31,15 +31,15 @@ export default forwardRef<HTMLDivElement, TimelineProjectProps>(function Timelin
<div className="flex items-start justify-between">
<h3 className="m-0 leading-none">{title}</h3>
<div className="-m-1 flex gap-3">
{links.map((link, index) => (
<LinkIcon key={index} icon={link.icon} to={link.to} label={link.label} className="p-1" />
{links.map((link) => (
<LinkIcon key={link.to} icon={link.icon} to={link.to} label={link.label} className="p-1" />
))}
</div>
</div>
<Markdown>{description}</Markdown>
<div className="flex flex-wrap gap-2">
{stack.map((tech, index) => (
<TimelineLabel key={index} text={tech} />
{stack.map((tech) => (
<TimelineLabel key={tech} text={tech} />
))}
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useOffset.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ElementRef, RefObject, useEffect, useState } from "react";
import { useEffect, useState, type ElementRef, type RefObject } from "react";

export default function useOffset(selfRef: RefObject<ElementRef<"div">>, otherRef: RefObject<ElementRef<"div">>) {
const [scrollPosition, setScrollPosition] = useState(0);
Expand All @@ -11,7 +11,7 @@ export default function useOffset(selfRef: RefObject<ElementRef<"div">>, otherRe
if (self && other) {
const top = self.getBoundingClientRect().top - other.getBoundingClientRect().top;
const height = other.getBoundingClientRect().height - self.getBoundingClientRect().height;
if (height != 0) setScrollPosition(top / height);
if (height !== 0) setScrollPosition(top / height);
}
};
window.addEventListener("resize", updatePosition);
Expand All @@ -21,7 +21,7 @@ export default function useOffset(selfRef: RefObject<ElementRef<"div">>, otherRe
window.removeEventListener("resize", updatePosition);
window.removeEventListener("scroll", updatePosition);
};
}, []);
}, [selfRef.current, otherRef.current]);

return scrollPosition;
}
2 changes: 1 addition & 1 deletion src/layouts/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Outlet } from "react-router-dom";

import Footer from "@/components/Footer";
import Navbar, { TextLink } from "@/components/Navbar/Navbar";
import Navbar, { type TextLink } from "@/components/Navbar/Navbar";

export default function Layout() {
const links: TextLink[] = [
Expand Down
2 changes: 1 addition & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const router = createBrowserRouter([
},
]);

ReactDOM.createRoot(document.getElementById("root")!).render(
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<RouterProvider router={router} />
</React.StrictMode>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ElementRef, RefObject } from "react";
import type { ElementRef, RefObject } from "react";

type Pos = { x: number; y: number };

Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default {
require("@tailwindcss/typography"),
require("@tailwindcss/forms"),
require("tailwindcss-3d"),
function ({ addComponents, matchUtilities, theme }) {
({ addComponents, matchUtilities, theme }) => {
addComponents({
// Utility component to fill an svg with a gradient.
// See: https://fvsch.com/svg-gradient-fill
Expand Down

0 comments on commit db2afe5

Please sign in to comment.