-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactorized the [slug].tsx & index.tsx --- all of them were related …
…to blog
- Loading branch information
1 parent
e0d6f1c
commit 62f2c6b
Showing
16 changed files
with
117 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Heading, Heading2, Text, List, BlockQuote, Anchor } from "./elements"; | ||
|
||
export const MDXComponents = { | ||
h1: (props: any) => <Heading {...props}></Heading>, | ||
h2: (props: any) => <Heading2 {...props}></Heading2>, | ||
p: (props: any) => <Text {...props}></Text>, | ||
ul: (props: any) => <List {...props}></List>, | ||
blockquote: (props: any) => <BlockQuote {...props}></BlockQuote>, | ||
a: (props: any) => <Anchor {...props}></Anchor>, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from "react"; | ||
import Link from "next/link"; | ||
|
||
import { NavProps } from "@/types/Blogs"; | ||
|
||
export default function Navbar({ links, technology, slug }: NavProps) { | ||
return ( | ||
<nav | ||
className={`fixed bg-white md:bg-transparent md:sticky top-0 md:top-24 left-0 h-screen md:h-auto z-50 duration-200`} | ||
> | ||
<div className="w-64 px-4 mt-4"> | ||
<h1 className="font-medium">{technology}</h1> | ||
{links.map((d) => ( | ||
<Link | ||
key={d.frontmatter.title} | ||
href={`${ | ||
slug | ||
? d.slug.replace(".mdx", "") | ||
: `${technology.toLowerCase()}/${d.slug.replace(".mdx", "")}` | ||
}`} | ||
> | ||
<p | ||
className={`px-4 py-1 mt-2 border-l-2 hover:border-primary capitalize ${ | ||
slug == d.slug.replace(".mdx", "") && | ||
"text-primary border-primary" | ||
}`} | ||
> | ||
{d.slug.replace(".mdx", "").replaceAll("-", " ")} | ||
</p> | ||
</Link> | ||
))} | ||
</div> | ||
</nav> | ||
); | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export { default as Heading } from "./Heading"; | ||
export { default as Heading2 } from "./Heading2"; | ||
export { default as BlockQuote } from "./BlockQuote"; | ||
export { default as Image } from "./Image"; | ||
export { default as List } from "./List"; | ||
export { default as Text } from "./Text"; | ||
export { default as Anchor } from "./Anchor"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import React, { useEffect } from "react"; | ||
import { useRouter } from "next/router"; | ||
import React from "react"; | ||
import Link from "next/link"; | ||
import { Container } from "@/components"; | ||
|
||
type Props = {}; | ||
|
||
export default function Index() { | ||
const router = useRouter(); | ||
useEffect(() => { | ||
router.pathname == "/docs" && router.push("/docs/intro"); | ||
}, []); | ||
return ( | ||
<Container className="mt-24"> | ||
<Link href={"docs/html"}>HTML</Link> | ||
<Link href={"docs/css"}>CSS</Link> | ||
<Link href={"docs/js"}>JS</Link> | ||
<Link href={"docs/open-source"}>Open Source</Link> | ||
</Container> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export type BlogProps = { | ||
blogs: { | ||
frontmatter: { | ||
title: string; | ||
category: string[]; | ||
author: string; | ||
order: number; | ||
}; | ||
slug: string; | ||
}[]; | ||
}; | ||
|
||
export type NavProps = { | ||
links: { | ||
frontmatter: { | ||
title: string; | ||
category: string[]; | ||
author: string; | ||
order: number; | ||
}; | ||
slug: string; | ||
}[]; | ||
technology: string; | ||
slug?: string | string[] | undefined; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
|
||
// // HTML | ||
// export const htmlPathFiles = path.join(process.cwd(), "blog/html"); | ||
// export const htmlFileNames = fs.readdirSync(htmlPathFiles, { | ||
// withFileTypes: false, | ||
// }); | ||
|
||
// CSS | ||
export const cssPathFiles = path.join(process.cwd(), "blog/css"); | ||
export const cssFileNames = fs.readdirSync(cssPathFiles, { | ||
withFileTypes: false, | ||
}); | ||
|
||
// // JS | ||
// export const jsPathFiles = path.join(process.cwd(), "blog/js"); | ||
// export const jsFileNames = fs.readdirSync(jsPathFiles, { | ||
// withFileTypes: false, | ||
// }); | ||
|
||
// // open-source | ||
// export const openSourcePathFiles = path.join(process.cwd(), "blog/openSource"); | ||
// export const openSourceFileNames = fs.readdirSync(openSourcePathFiles, { | ||
// withFileTypes: false, | ||
// }); |
62f2c6b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
anilearn – ./
anilearn-git-main-alireza1083.vercel.app
anilearn.vercel.app
anilearn-alireza1083.vercel.app