refactor: clean up imports and improve formatting in layout, particle… · javaistic/javaistic@c04a4a7 · GitHub
Skip to content

Commit c04a4a7

Browse files
committed
refactor: clean up imports and improve formatting in layout, particles, footer, icons, and button components
1 parent 2b0280c commit c04a4a7

5 files changed

Lines changed: 39 additions & 32 deletions

File tree

src/app/docs/layout.tsx

Lines changed: 2 additions & 5 deletions

src/components/Particles.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ const defaultColors: string[] = ["#ffffff", "#ffffff", "#ffffff"];
2121
const hexToRgb = (hex: string): [number, number, number] => {
2222
hex = hex.replace(/^#/, "");
2323
if (hex.length === 3) {
24-
hex = hex.split("").map((c) => c + c).join("");
24+
hex = hex
25+
.split("")
26+
.map((c) => c + c)
27+
.join("");
2528
}
2629
const int = parseInt(hex, 16);
2730
const r = ((int >> 16) & 255) / 255;
@@ -142,7 +145,10 @@ const Particles: React.FC<ParticlesProps> = ({
142145
const positions = new Float32Array(count * 3);
143146
const randoms = new Float32Array(count * 4);
144147
const colors = new Float32Array(count * 3);
145-
const palette = particleColors && particleColors.length > 0 ? particleColors : defaultColors;
148+
const palette =
149+
particleColors && particleColors.length > 0
150+
? particleColors
151+
: defaultColors;
146152

147153
for (let i = 0; i < count; i++) {
148154
let x: number, y: number, z: number, len: number;
@@ -154,7 +160,10 @@ const Particles: React.FC<ParticlesProps> = ({
154160
} while (len > 1 || len === 0);
155161
const r = Math.cbrt(Math.random());
156162
positions.set([x * r, y * r, z * r], i * 3);
157-
randoms.set([Math.random(), Math.random(), Math.random(), Math.random()], i * 4);
163+
randoms.set(
164+
[Math.random(), Math.random(), Math.random(), Math.random()],
165+
i * 4,
166+
);
158167
const col = hexToRgb(palette[Math.floor(Math.random() * palette.length)]);
159168
colors.set(col, i * 3);
160169
}
@@ -237,10 +246,7 @@ const Particles: React.FC<ParticlesProps> = ({
237246
]);
238247

239248
return (
240-
<div
241-
ref={containerRef}
242-
className={`relative w-full h-full ${className}`}
243-
/>
249+
<div ref={containerRef} className={`relative h-full w-full ${className}`} />
244250
);
245251
};
246252

src/components/footer.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ const footerNav = {
3535

3636
export function Footer() {
3737
return (
38-
<footer className="bg-neutral-100 dark:bg-neutral-900 pt-16 pb-10 sm:pt-20 md:pt-24 xl:pt-28">
38+
<footer className="bg-neutral-100 pt-16 pb-10 sm:pt-20 md:pt-24 xl:pt-28 dark:bg-neutral-900">
3939
<div className="mx-auto max-w-screen-xl px-4 sm:px-6 md:px-8">
4040
{/* Navigation Links */}
41-
<div className="grid grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-8 pb-14 sm:pb-20 text-sm font-medium">
42-
<div className="flex flex-col items-start col-span-2 sm:col-span-2 gap-y-6">
41+
<div className="grid grid-cols-2 gap-8 pb-14 text-sm font-medium sm:grid-cols-2 sm:pb-20 md:grid-cols-3 lg:grid-cols-6">
42+
<div className="col-span-2 flex flex-col items-start gap-y-6 sm:col-span-2">
4343
<Logo className="h-8 w-auto" />
4444
<p className="text-muted-foreground">
4545
High quality Java coding education maintained by an open source
@@ -49,34 +49,34 @@ export function Footer() {
4949
<Link
5050
href="https://github.com/javaistic/javaistic"
5151
aria-label="GitHub"
52-
className="transition-colors duration-200 ease-in-out text-muted-foreground hover:text-[#181717] dark:hover:text-white"
52+
className="text-muted-foreground transition-colors duration-200 ease-in-out hover:text-[#181717] dark:hover:text-white"
5353
>
5454
<GitHubIcon className="h-5 w-5" />
5555
</Link>
5656
<Link
5757
href="/discord"
5858
aria-label="Discord"
59-
className="transition-colors duration-200 ease-in-out text-muted-foreground hover:text-[#5865F2]"
59+
className="text-muted-foreground transition-colors duration-200 ease-in-out hover:text-[#5865F2]"
6060
>
6161
<DiscordIcon className="h-5 w-5" />
6262
</Link>
6363
<Link
6464
href="https://x.com/javaistic"
6565
aria-label="X (formerly Twitter)"
66-
className="transition-colors duration-200 ease-in-out text-muted-foreground hover:text-foreground"
66+
className="text-muted-foreground hover:text-foreground transition-colors duration-200 ease-in-out"
6767
>
6868
<TwitterIcon className="h-5 w-5" />
6969
</Link>
7070
<Link
7171
href="https://opencollective.com/javaistic"
7272
aria-label="Open Collective"
73-
className="transition-colors duration-200 ease-in-out text-muted-foreground hover:text-[#7FADF2]"
73+
className="text-muted-foreground transition-colors duration-200 ease-in-out hover:text-[#7FADF2]"
7474
>
7575
<OpenCollectiveIcon className="h-5 w-5" />
7676
</Link>
7777
</div>
7878

79-
<div className="text-sm text-neutral-500 flex items-center space-x-1">
79+
<div className="flex items-center space-x-1 text-sm text-neutral-500">
8080
<span>Made by</span>
8181
<Link
8282
href="https://arghya.dev?ref=javaistic"
@@ -90,15 +90,15 @@ export function Footer() {
9090
</div>
9191
{Object.entries(footerNav).map(([section, items]) => (
9292
<div key={section}>
93-
<h2 className="text-lg font-bold text-foreground mb-4">
93+
<h2 className="text-foreground mb-4 text-lg font-bold">
9494
{section}
9595
</h2>
9696
<ul className="space-y-3">
9797
{items.map((item) => (
9898
<li key={item.title}>
9999
<Link
100100
href={item.href}
101-
className="transition-colors duration-200 ease-in-out text-muted-foreground hover:text-foreground"
101+
className="text-muted-foreground hover:text-foreground transition-colors duration-200 ease-in-out"
102102
>
103103
{item.title}
104104
</Link>
@@ -110,7 +110,7 @@ export function Footer() {
110110
</div>
111111

112112
{/* Legal and Badge */}
113-
<div className="flex flex-col gap-y-2 sm:flex-row items-center justify-between text-sm text-neutral-500">
113+
<div className="flex flex-col items-center justify-between gap-y-2 text-sm text-neutral-500 sm:flex-row">
114114
<h4>
115115
&copy; 2021 - {new Date().getFullYear()} Javaistic. All rights
116116
reserved.

src/components/icons.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { JSX, SVGProps } from "react";
22

33
export function GitHubIcon(
4-
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>
4+
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
55
) {
66
return (
77
<svg
@@ -20,7 +20,7 @@ export function GitHubIcon(
2020
}
2121

2222
export function TwitterIcon(
23-
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>
23+
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
2424
) {
2525
return (
2626
<svg
@@ -39,22 +39,26 @@ export function TwitterIcon(
3939
}
4040

4141
export function DiscordIcon(
42-
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>
42+
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
4343
) {
4444
return (
45-
<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"
46-
{...props}
45+
<svg
46+
role="img"
47+
viewBox="0 0 24 24"
48+
xmlns="http://www.w3.org/2000/svg"
49+
{...props}
4750
>
4851
<title>Discord</title>
4952
<path
50-
fill="currentColor"
51-
d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
53+
fill="currentColor"
54+
d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"
55+
/>
5256
</svg>
5357
);
5458
}
5559

5660
export function OpenCollectiveIcon(
57-
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>
61+
props: JSX.IntrinsicAttributes & SVGProps<SVGSVGElement>,
5862
) {
5963
return (
6064
<svg

src/components/ui/button.tsx

Lines changed: 1 addition & 1 deletion

0 commit comments

Comments
 (0)