Skip to content

Commit

Permalink
refactor: merge config file to one
Browse files Browse the repository at this point in the history
  • Loading branch information
01Joseph-Hwang10 committed Aug 30, 2023
1 parent 036c372 commit 26d267c
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 140 deletions.
1 change: 0 additions & 1 deletion config/.gitignore

This file was deleted.

56 changes: 0 additions & 56 deletions config/docusaurus/footer.js

This file was deleted.

41 changes: 0 additions & 41 deletions config/docusaurus/navbar.js

This file was deleted.

9 changes: 0 additions & 9 deletions config/package.json

This file was deleted.

13 changes: 0 additions & 13 deletions config/tsconfig.json

This file was deleted.

14 changes: 0 additions & 14 deletions config/values/personal.js

This file was deleted.

114 changes: 110 additions & 4 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,110 @@ const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");

// Custom values.
const personal = require("./config/values/personal");
const navbar = require("./config/docusaurus/navbar");

const personal = {
myName: "황현규",
tagline: "Start-up Enthusiast",
github: {
url: "https://github.com/01Joseph-Hwang10",
username: "01Joseph-Hwang10",
reponame: "01joseph-hwang10.github.io",
},
stackoverflow: "https://stackoverflow.com/users/14837031/joseph-hwang",
leetcode: "https://leetcode.com/01Joseph-Hwang10/",
email: "[email protected]",
};

/** @type {import('@docusaurus/preset-classic').ThemeConfig['navbar']} */
const navbar = {
title: `${personal.myName}'s Page`,
hideOnScroll: false,
logo: {
alt: `${personal.myName}'s Logo`,
src: "img/logo.svg",
},
items: [
// {
// type: "docSidebar",
// sidebarId: "documentsSidebar",
// position: "left",
// label: "Documents",
// },
{
to: "/docs/category/%EC%9D%B4%EB%A0%A5%EC%84%9C",
label: "Resume",
position: "left",
},
{
to: "/docs/category/%EA%B2%BD%EB%A0%A5-%EA%B8%B0%EC%88%A0%EC%84%9C",
label: "Career Description",
position: "left",
},
// { to: "/blog", label: "Blog", position: "left" },
{
type: "localeDropdown",
position: "right",
},
{
href: personal.github.url,
label: "GitHub",
position: "right",
},
],
};

/** @type {import('@docusaurus/preset-classic').ThemeConfig['footer']} */
const footer = {
style: "dark",
links: [
{
title: "Docs",
items: [
{
label: "Career Description",
to: "/docs/category/%EA%B2%BD%EB%A0%A5-%EA%B8%B0%EC%88%A0%EC%84%9C",
},
{
label: "Resume",
to: "/docs/category/%EC%9D%B4%EB%A0%A5%EC%84%9C",
},
],
},
{
title: "Community",
items: [
{
label: "Stack Overflow",
href: personal.stackoverflow,
},
{
label: "Leet Code",
href: personal.leetcode,
},
{
label: "Email",
href: `mailto:${personal.email}`,
},
],
},
{
title: "More",
items: [
{
label: "Blog",
to: "/blog",
},
{
label: "GitHub",
href: personal.github.url,
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} ${
personal.myName
}. Built with Docusaurus.`,
};

/** @type {import('@docusaurus/types').Config} */
const config = {
Expand Down Expand Up @@ -39,6 +141,10 @@ const config = {
locales: ["ko"],
},

customFields: {
personal,
},

presets: [
[
"classic",
Expand All @@ -63,8 +169,8 @@ const config = {
({
// Replace with your project's social card
image: "img/docusaurus-social-card.jpg",
navbar: require("./config/docusaurus/navbar"),
footer: require("./config/docusaurus/footer"),
navbar,
footer,
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
Expand Down
2 changes: 1 addition & 1 deletion src/page-contents/Home/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Head from "@docusaurus/Head";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import { useBaseUrlUtils } from "@docusaurus/useBaseUrl";
import personal from "@site/config/values/personal";
import React from "react";

const HomepageHead: React.FC = () => {
const { siteConfig } = useDocusaurusContext();
const personal = siteConfig.customFields.personal as Record<string, string>;
const { withBaseUrl } = useBaseUrlUtils();
const pageTitle = `${personal.myName} - ${personal.tagline}`;
const description = siteConfig.tagline;
Expand Down
2 changes: 1 addition & 1 deletion src/page-contents/Home/Header/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import HomepageHero from "./Hero";
import personal from "@site/config/values/personal";
import Link from "@docusaurus/Link";
import { translate } from "@docusaurus/Translate";
// @ts-ignore
Expand All @@ -10,6 +9,7 @@ import clsx from "clsx";

const HomepageHeader: React.FC = () => {
const { siteConfig } = useDocusaurusContext();
const personal = siteConfig.customFields.personal as Record<string, string>;

return (
<HomepageHero>
Expand Down

0 comments on commit 26d267c

Please sign in to comment.