Skip to content

Commit 32a48b3

Browse files
committed
setup
1 parent fa6b4da commit 32a48b3

24 files changed

+2084
-67
lines changed

package-lock.json

Lines changed: 1606 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,20 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13+
"clsx": "^2.1.1",
14+
"framer-motion": "^11.3.28",
1315
"react": "^18.3.1",
14-
"react-dom": "^18.3.1"
16+
"react-dom": "^18.3.1",
17+
"react-markdown": "^9.0.1",
18+
"react-router-dom": "^6.26.1",
19+
"react-syntax-highlighter": "^15.5.0",
20+
"tailwind-merge": "^2.5.2"
1521
},
1622
"devDependencies": {
1723
"@types/react": "^18.3.3",
1824
"@types/react-dom": "^18.3.0",
25+
"@types/react-router-dom": "^5.3.3",
26+
"@types/react-syntax-highlighter": "^15.5.13",
1927
"@typescript-eslint/eslint-plugin": "^7.15.0",
2028
"@typescript-eslint/parser": "^7.15.0",
2129
"@vitejs/plugin-react": "^4.3.1",

src/App.css

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/App.tsx

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
1-
function App() {
1+
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
2+
import CategoryList from './components/CategoryList';
3+
import TopicList from './components/TopicList';
4+
import MarkdownViewer from './components/MarkdownViewer';
5+
6+
const App = () => {
27
return (
3-
<>
4-
<div className='mt-4 text-3xl'>Gopher Notes!</div>
5-
</>
8+
<Router>
9+
<div className='absolute top-0 z-[-2] h-screen w-screen bg-neutral-950 bg-[radial-gradient(ellipse_80%_80%_at_50%_-20%,rgba(120,119,198,0.3),rgba(255,255,255,0))]'></div>
10+
<Routes>
11+
<Route
12+
path='/'
13+
element={<CategoryList />}
14+
/>
15+
<Route
16+
path='/:category'
17+
element={<TopicList />}
18+
/>
19+
<Route
20+
path='/:category/:topic'
21+
element={<MarkdownViewer />}
22+
/>
23+
</Routes>
24+
</Router>
625
);
7-
}
26+
};
827

928
export default App;

src/assets/fonts/Inter-Bold.otf

227 KB
Binary file not shown.

src/assets/fonts/Inter-Medium.otf

225 KB
Binary file not shown.

src/assets/fonts/Inter-Regular.otf

218 KB
Binary file not shown.

src/assets/fonts/Inter-SemiBold.otf

226 KB
Binary file not shown.

src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/CategoryList.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { Link } from 'react-router-dom';
2+
3+
const categories = [
4+
{ name: 'Intro', path: '/intro' },
5+
{ name: 'Variables', path: '/variables' },
6+
];
7+
8+
const CategoryList = () => {
9+
return (
10+
<div>
11+
<h1>Categories</h1>
12+
<ul>
13+
{categories.map((category) => (
14+
<li key={category.name}>
15+
<Link to={category.path}>{category.name.split('-').join(' ')}</Link>
16+
</li>
17+
))}
18+
</ul>
19+
</div>
20+
);
21+
};
22+
23+
export default CategoryList;

src/components/MarkdownViewer.tsx

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import { useState, useEffect } from 'react';
2+
import ReactMarkdown from 'react-markdown';
3+
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
4+
import { dracula } from 'react-syntax-highlighter/dist/esm/styles/prism';
5+
import { useParams } from 'react-router-dom';
6+
7+
import { HoverEffect } from './ui/card-hover-effect';
8+
9+
const MarkdownViewer = () => {
10+
const { category, topic } = useParams();
11+
const [markdown, setMarkdown] = useState('');
12+
13+
useEffect(() => {
14+
const fetchMarkdown = async () => {
15+
try {
16+
const module = await import(`../data/${category}/${topic}.md`);
17+
setMarkdown(module.default);
18+
} catch (error) {
19+
console.error('Error fetching markdown:', error);
20+
}
21+
};
22+
23+
fetchMarkdown();
24+
}, [category, topic]);
25+
26+
return (
27+
<div className='bg-slate-900 min-h-[100vh]'>
28+
<div className='w-11/12 mx-auto py-4 leading-relaxed '>
29+
<ReactMarkdown
30+
children={markdown}
31+
components={{
32+
code({ node, inline, className, children, ...props }) {
33+
const match = /language-(\w+)/.exec(className || '');
34+
return !inline && match ? (
35+
<SyntaxHighlighter
36+
style={dracula}
37+
language={match[1]}
38+
PreTag='div'
39+
{...props}
40+
>
41+
{String(children).replace(/\n$/, '')}
42+
</SyntaxHighlighter>
43+
) : (
44+
<code
45+
className={className}
46+
{...props}
47+
>
48+
{children}
49+
</code>
50+
);
51+
},
52+
}}
53+
/>
54+
55+
<div className='px-8'>
56+
<HoverEffect items={projects} />
57+
</div>
58+
</div>
59+
</div>
60+
);
61+
};
62+
63+
export const projects = [
64+
{
65+
title: 'Stripe',
66+
description:
67+
'A technology company that builds economic infrastructure for the internet.',
68+
},
69+
{
70+
title: 'Netflix',
71+
description:
72+
'A streaming service that offers a wide variety of award-winning TV shows, movies, anime, documentaries, and more on thousands of internet-connected devices.',
73+
},
74+
{
75+
title: 'Google',
76+
description:
77+
'A multinational technology company that specializes in Internet-related services and products.',
78+
},
79+
{
80+
title: 'Meta',
81+
description:
82+
"A technology company that focuses on building products that advance Facebook's mission of bringing the world closer together.",
83+
},
84+
{
85+
title: 'Amazon',
86+
description:
87+
'A multinational technology company focusing on e-commerce, cloud computing, digital streaming, and artificial intelligence.',
88+
},
89+
{
90+
title: 'Microsoft',
91+
description:
92+
'A multinational technology company that develops, manufactures, licenses, supports, and sells computer software, consumer electronics, personal computers, and related services.',
93+
},
94+
];
95+
96+
export default MarkdownViewer;

src/components/TopicList.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { Link, useParams } from 'react-router-dom';
2+
3+
const topics = {
4+
intro: ['what-is-go', 'setting-up-go', 'basic-syntax'],
5+
variables: ['declaring-variables', 'variable-types', 'constants'],
6+
};
7+
8+
const TopicList = () => {
9+
const { category } = useParams<{ category: string }>();
10+
const topicList = topics[category as keyof typeof topics] || [];
11+
12+
return (
13+
<div>
14+
<h1>{category}</h1>
15+
<ul>
16+
{topicList.map((topic) => (
17+
<li key={topic}>
18+
<Link to={`/${category}/${topic}`}>
19+
{topic.split('-').join(' ')}
20+
</Link>
21+
</li>
22+
))}
23+
</ul>
24+
</div>
25+
);
26+
};
27+
28+
export default TopicList;

0 commit comments

Comments
 (0)