Skip to content

Commit 5fc4c6a

Browse files
authored
chore: small fixes (#30)
1 parent a415f67 commit 5fc4c6a

File tree

6 files changed

+71
-21
lines changed

6 files changed

+71
-21
lines changed

src/AllNotes.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Socials } from "./Academic";
2+
import NotesIndex from "./components/NoteIndex";
3+
import Tabs from "./components/Tabs";
4+
import { Hero } from "./Pool";
5+
6+
export default () => {
7+
return (
8+
<>
9+
<Hero className="md:col-span-2" />
10+
<div className="flex flex-col">
11+
<Socials className="mt-8" />
12+
<Tabs />
13+
</div>
14+
<div className="col-span-3">
15+
<NotesIndex showTags={true}></NotesIndex>
16+
</div>
17+
</>
18+
);
19+
};

src/Pool.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import Balls from "./components/Balls";
66
import Logo from "./Logo";
77
import A from "./components/A";
88
import NotesIndex from "./components/NoteIndex";
9+
import { Link } from "react-router-dom";
910

1011
export const Hero = ({ className }: { className?: string }) => (
1112
<div className={className}>
@@ -50,12 +51,19 @@ export default () => {
5051
<Section header={"Notes"}>
5152
<Text>
5253
I keep some Obsidian notes on pool, including practice sessions,
53-
drills, and reflections on past competitions.
54+
drills, and reflections on past competitions. Here are some more
55+
organized ones, see{" "}
56+
<Link to="/pool/notes">
57+
<A>here for all the notes </A>
58+
</Link>
59+
.
5460
</Text>
5561
<NoteHeader>Drills</NoteHeader>
5662
<NotesIndex tag="drill" />
5763
<NoteHeader>Tournaments</NoteHeader>
5864
<NotesIndex tag="tournament" />
65+
<NoteHeader>Practice notes</NoteHeader>
66+
<NotesIndex tag="journal" />
5967
</Section>
6068
<Section header={"Background"}>
6169
<Background />

src/components/NoteIndex.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
// src/NotesIndex.tsx
22
import { Link } from "react-router-dom";
33
import { notes } from "../notes"; // from step #2
4-
import Tabs from "./Tabs";
5-
import { Socials } from "../Academic";
6-
import { Hero } from "../Pool";
74
import Tags from "./Tags";
85

9-
export default function NotesIndex({ tag }: { tag?: string }) {
6+
export default function NotesIndex({
7+
tag,
8+
showTags,
9+
}: {
10+
tag?: string;
11+
showTags?: boolean;
12+
}) {
1013
const filtered = tag
1114
? notes.filter((note) => note.frontmatter?.tags?.includes(tag))
1215
: notes;
@@ -16,14 +19,16 @@ export default function NotesIndex({ tag }: { tag?: string }) {
1619
<ul>
1720
{filtered.map((note) => (
1821
<li key={note.slug}>
19-
<Link
20-
to={`/pool/notes/${note.slug}`}
21-
className="text-primary text-xl font-bold hover:text-primary/70"
22-
>
23-
<span className="flex flex-row gap-2">
24-
{note.frontmatter?.title ?? note.slug}
25-
</span>
26-
</Link>
22+
<div className="flex flex-row align-center gap-2">
23+
<Link to={`/pool/notes/${note.slug}`}>
24+
<span className="text-primary text-xl font-bold hover:text-primary/70">
25+
{note.frontmatter?.title ?? note.slug}
26+
</span>
27+
</Link>
28+
{showTags && note.frontmatter?.tags && (
29+
<Tags tags={note.frontmatter.tags} className="text-xs" />
30+
)}
31+
</div>
2732
</li>
2833
))}
2934
</ul>

src/components/Tags.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const Tags = ({ tags, className }: { className?: string; tags: string[] }) => (
2-
<div className="flex flex-wrap gap-2">
2+
<div className="flex flex-wrap gap-2 content-center">
33
{tags.map((tag: string) => (
44
<span
55
key={tag}

src/index.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React, { useEffect } from "react";
22
import ReactDOM from "react-dom/client";
3-
import App from "./Academic.js";
4-
import "./index.css";
5-
import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";
3+
import { BrowserRouter, Route, Routes } from "react-router-dom";
64
import Academic from "./Academic.js";
7-
import Pool from "./Pool.js";
5+
import AllNotes from "./AllNotes.js";
86
import Layout from "./Layout.js";
97
import NoPage from "./NoPage.js";
10-
import NotesIndex from "./components/NoteIndex.js";
8+
import Pool from "./Pool.js";
119
import NotePage from "./components/NotePage.js";
10+
import "./index.css";
1211

1312
function RedirectToPDF({ link }: { link: string }) {
1413
useEffect(() => {
@@ -28,7 +27,7 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
2827
<Route path="/pool" element={<Pool />} />
2928
<Route path="*" element={<NoPage />} />
3029
{/* An index page listing all notes */}
31-
<Route path="/pool/notes" element={<NotesIndex />} />
30+
<Route path="/pool/notes" element={<AllNotes />} />
3231
{/* A dynamic route for each individual note */}
3332
<Route path="/pool/notes/:slug" element={<NotePage />} />
3433
</Route>

tailwind.config.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,26 @@ module.exports = {
7070
"@apply border-l-4 border-gray-500 dark:border-gray-400 pl-4 italic":
7171
{},
7272
},
73-
73+
// table formatting
74+
table: {
75+
"@apply border-collapse border dark:border-gray-300 text-left text-sm my-8":
76+
{},
77+
},
78+
thead: {
79+
"@apply bg-gray-100 dark:bg-zinc-700 uppercase font-medium": {},
80+
},
81+
th: {
82+
"@apply border border-gray-300 px-4 py-2": {},
83+
},
84+
td: {
85+
"@apply border border-gray-300 px-4 py-2": {},
86+
},
87+
"tbody tr:nth-child(even)": {
88+
"@apply bg-zinc-50 dark:bg-zinc-700": {},
89+
},
90+
iframe: {
91+
"@apply max-w-full rounded py-4": {},
92+
},
7493
// If you wanted code/pre fences, you could add them too:
7594
// "pre, code": {
7695
// "@apply rounded bg-gray-100 text-sm": {},

0 commit comments

Comments
 (0)