Skip to content

Commit fb55b40

Browse files
committed
refactor(website): code optimization
1 parent 923ce8c commit fb55b40

File tree

5 files changed

+30
-38
lines changed

5 files changed

+30
-38
lines changed

apps/website/components/BskyPost.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface BskyPostProps {
1010

1111
export function BskyPost({ id, classNames, handle }: BskyPostProps) {
1212
return (
13-
<div className={cn("bsky-post", "not-prose", "my-8", classNames)}>
13+
<div className={cn("not-prose my-8", "bsky-post", classNames)}>
1414
<Post handle={handle} id={id} />
1515
</div>
1616
);

apps/website/components/GitHubRepo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GithubInfo } from "fumadocs-ui/components/github-info";
44
export function GitHubRepo({ className, token, ...rest }: Parameters<typeof GithubInfo>[0]) {
55
return (
66
<GithubInfo
7-
className={cn("rounded-lg", "bg-fd-card", "outline", "outline-fd-border", className)}
7+
className={cn("rounded-lg bg-fd-card outline outline-fd-border", className)}
88
token={token ?? process.env["GITHUB_TOKEN"] ?? ""}
99
{...rest}
1010
/>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { GitHubRepo } from "#/components/GitHubRepo";
2+
import { cn } from "#/lib/cn";
3+
4+
interface GitHubRepoGridProps {
5+
className?: string;
6+
repos: { owner: string; repo: string }[];
7+
}
8+
9+
export function GitHubRepoGrid({ className, repos }: GitHubRepoGridProps) {
10+
return (
11+
<div className={cn("not-prose grid grid-cols-1 gap-4 md:grid-cols-2", className)}>
12+
{repos.map(({ owner, repo }) => (
13+
<GitHubRepo
14+
key={`${owner}/${repo}`}
15+
owner={owner}
16+
repo={repo}
17+
/>
18+
))}
19+
</div>
20+
);
21+
}

apps/website/content/docs/community.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ title: Community
33
description: "Discover the growing community around ESLint React"
44
---
55

6-
import { BskyPost } from "../../components/BskyPost";
7-
import { CommunityShowcases, CommunityPresets } from "./community";
6+
import { BskyPost } from "#/components/BskyPost";
7+
import { GitHubRepoGrid } from "#/components/GitHubRepoGrid";
8+
import { projects, presets } from "./community.tsx"
89

910
## OSS Projects Using ESLint React
1011

11-
<CommunityShowcases />
12+
<GitHubRepoGrid repos={projects} />
1213

1314
<small>
1415

@@ -28,4 +29,4 @@ Find more on [https://x.com/search?q=eslint-react.xyz](https://x.com/search?q=es
2829

2930
**Community Maintained Presets that use ESLint React**
3031

31-
<CommunityPresets />
32+
<GitHubRepoGrid repos={presets} />
Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
import { GitHubRepo } from "#/components/GitHubRepo";
2-
3-
const repos = [
1+
export const projects = [
42
{ owner: "DimensionDev", repo: "Maskbook" },
53
{ owner: "electric-sql", repo: "electric" },
64
{ owner: "electric-sql", repo: "pglite" },
@@ -25,38 +23,10 @@ const repos = [
2523
{ owner: "XYOracleNetwork", repo: "sdk-xyo-react-js" },
2624
];
2725

28-
const presets = [
26+
export const presets = [
2927
{ owner: "AndreaPontrandolfo", repo: "sheriff" },
3028
{ owner: "antfu", repo: "eslint-config" },
3129
{ owner: "RebeccaStevens", repo: "eslint-config-rebeccastevens" },
3230
{ owner: "SukkaW", repo: "eslint-config-sukka" },
3331
{ owner: "upleveled", repo: "eslint-config-upleveled" },
3432
];
35-
36-
export function CommunityShowcases() {
37-
return (
38-
<div className="not-prose grid grid-cols-1 gap-4 md:grid-cols-2">
39-
{repos.map(({ owner, repo }) => (
40-
<GitHubRepo
41-
key={`${owner}/${repo}`}
42-
owner={owner}
43-
repo={repo}
44-
/>
45-
))}
46-
</div>
47-
);
48-
}
49-
50-
export function CommunityPresets() {
51-
return (
52-
<div className="not-prose grid grid-cols-1 gap-4 md:grid-cols-2">
53-
{presets.map(({ owner, repo }) => (
54-
<GitHubRepo
55-
key={`${owner}/${repo}`}
56-
owner={owner}
57-
repo={repo}
58-
/>
59-
))}
60-
</div>
61-
);
62-
}

0 commit comments

Comments
 (0)