Skip to content

Commit 1925385

Browse files
committed
➕ADD, FIX: mdx, remove ghost cms, dark mode
1 parent 058fb65 commit 1925385

36 files changed

+4233
-224
lines changed

components/ConsCard.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default function ConsCard({ title, cons }) {
2+
return (
3+
<div className="border border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-900 rounded p-6 my-6 w-full">
4+
<span>{`You might not use ${title} if...`}</span>
5+
<div className="mt-4">
6+
{cons.map((con) => (
7+
<div key={con} className="flex font-medium items-baseline mb-2">
8+
<div className="h-4 w-4 mr-2">
9+
<svg className="h-4 w-4 text-red-500" viewBox="0 0 24 24">
10+
<g
11+
fill="none"
12+
stroke="currentColor"
13+
strokeWidth="2"
14+
strokeLinecap="round"
15+
strokeLinejoin="round"
16+
>
17+
<path d="M22 11.08V12a10 10 0 11-5.93-9.14" />
18+
<path d="M22 4L12 14.01l-3-3" />
19+
</g>
20+
</svg>
21+
</div>
22+
<span>{con}</span>
23+
</div>
24+
))}
25+
</div>
26+
</div>
27+
);
28+
}

components/Contact.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function Contact() {
6161
</p>
6262
<a
6363
href="https://wa.me/919587738861?text=I want to work on a project with you"
64-
className="mt-4 px-4 text-center w-full font-bold h-8 bg-green-400 dark:bg-gray-700 text-gray-900 py-1 dark:text-gray-100 rounded"
64+
className="mt-4 px-4 text-center w-full font-bold h-8 bg-green-400 dark:bg-green-400 text-gray-900 py-1 dark:text-gray-900 rounded"
6565
type="submit"
6666
>
6767
Chat on WhatsApp

components/Container.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import Head from "next/head";
22
import { useRouter } from "next/router";
33
import { useState, useEffect } from "react";
44
import NextLink from "next/link";
5+
import { useTheme } from "next-themes";
56

67
import Footer from "@/components/Footer";
78

89
export default function Container(props) {
910
const [mounted, setMounted] = useState(false);
11+
const { theme, setTheme } = useTheme();
1012

1113
// After mounting, we have access to the theme
1214
useEffect(() => setMounted(true), []);
@@ -54,7 +56,7 @@ export default function Container(props) {
5456
aria-label="Toggle Dark Mode"
5557
type="button"
5658
className="bg-gray-200 dark:bg-gray-800 rounded p-3 h-10 w-10"
57-
// onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
59+
onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
5860
>
5961
{mounted && (
6062
<svg
@@ -64,21 +66,21 @@ export default function Container(props) {
6466
stroke="currentColor"
6567
className="h-4 w-4 text-gray-800 dark:text-gray-200"
6668
>
67-
{/* {theme === "dark" ? (
69+
{theme === "dark" ? (
6870
<path
6971
strokeLinecap="round"
7072
strokeLinejoin="round"
7173
strokeWidth={2}
7274
d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"
7375
/>
74-
) : ( */}
75-
<path
76-
strokeLinecap="round"
77-
strokeLinejoin="round"
78-
strokeWidth={2}
79-
d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
80-
/>
81-
{/* )} */}
76+
) : (
77+
<path
78+
strokeLinecap="round"
79+
strokeLinejoin="round"
80+
strokeWidth={2}
81+
d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z"
82+
/>
83+
)}
8284
</svg>
8385
)}
8486
</button>
@@ -109,7 +111,7 @@ export default function Container(props) {
109111
</nav>
110112
<main
111113
id="skip"
112-
className="flex flex-col justify-center bg-white dark:bg-black px-8"
114+
className="flex flex-col justify-center bg-white dark:bg-black px-8 text-gray-900 dark:text-gray-100"
113115
>
114116
{children}
115117
<Footer />

components/MDXComponents.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Link from "next/link";
2+
import Image from "next/image";
3+
import Tweet from "react-tweet-embed";
4+
5+
import ProsCard from "@/components/ProsCard";
6+
import ConsCard from "@/components/ConsCard";
7+
// import Gumroad from "@/components/metrics/Gumroad";
8+
// import Unsplash from "@/components/metrics/Unsplash";
9+
// import Analytics from "@/components/metrics/Analytics";
10+
// import YouTube from "@/components/metrics/Youtube";
11+
import Step from "@/components/Step";
12+
13+
const CustomLink = (props) => {
14+
const href = props.href;
15+
const isInternalLink = href && (href.startsWith("/") || href.startsWith("#"));
16+
17+
if (isInternalLink) {
18+
return (
19+
<Link href={href}>
20+
<a {...props} />
21+
</Link>
22+
);
23+
}
24+
25+
return <a target="_blank" rel="noopener noreferrer" {...props} />;
26+
};
27+
28+
const MDXComponents = {
29+
Image,
30+
a: CustomLink,
31+
ConsCard,
32+
ProsCard,
33+
Step,
34+
Tweet,
35+
};
36+
37+
export default MDXComponents;

components/ProjectCard.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ export default function ProjectCard({ title, description, href, icon, tags }) {
244244
{tags?.map((tag, idx) => (
245245
<p
246246
key={idx}
247-
className={`leading-5 text-gray-700 dark:text-gray-300 rounded-md text-xs italic bg-gray-50 `}
247+
className={`leading-5 dark:border text-gray-700 dark:text-gray-300 dark:bg-transparent rounded-md text-xs italic bg-gray-50 `}
248248
>
249249
{tag}
250250
</p>

components/ProsCard.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
export default function ProsCard({ title, pros }) {
2+
return (
3+
<div className="border border-green-200 dark:border-green-900 bg-green-50 dark:bg-green-900 rounded p-6 my-4 w-full">
4+
<span>{`You might use ${title} if...`}</span>
5+
<div className="mt-4">
6+
{pros.map((pro) => (
7+
<div key={pro} className="flex font-medium items-baseline mb-2">
8+
<div className="h-4 w-4 mr-2">
9+
<svg className="h-4 w-4 text-green-500" viewBox="0 0 24 24">
10+
<g
11+
fill="none"
12+
stroke="currentColor"
13+
strokeWidth="2"
14+
strokeLinecap="round"
15+
strokeLinejoin="round"
16+
>
17+
<path d="M22 11.08V12a10 10 0 11-5.93-9.14" />
18+
<path d="M22 4L12 14.01l-3-3" />
19+
</g>
20+
</svg>
21+
</div>
22+
<span>{pro}</span>
23+
</div>
24+
))}
25+
</div>
26+
</div>
27+
);
28+
}

components/Step.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default function Step({ number, title }) {
2+
return (
3+
<div className="step flex items-center py-4">
4+
<div className="flex items-center justify-center border border-gray-200 font-bold dark:border-gray-900 rounded-full h-8 w-8 text-blue-500">
5+
{number}
6+
</div>
7+
<h3 className="ml-3 tracking-tight font-bold">{title}</h3>
8+
</div>
9+
);
10+
}

0 commit comments

Comments
 (0)