Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: #9 #10

Merged
merged 1 commit into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/blog/_config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import jsonData from './index.json';

export const blogName = jsonData.blogName;
export const blogDescription = jsonData.blogDescription;
export const blogRepo = jsonData.blogRepo;
export const blogUrl = jsonData.blogUrl;
3 changes: 1 addition & 2 deletions apps/blog/src/components/AuthorSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import { Avatar, Link } from '@nextui-org/react';
import { KBarToggleButton } from 'core';

import { authorImage, authorName, defaultUrl } from 'core/constants';
import config from '../../../_config/index.json';
const { blogDescription } = config;
import { blogDescription } from '../../../_config';

interface Props {
marginBottom?: string;
Expand Down
3 changes: 1 addition & 2 deletions apps/blog/src/components/Comments/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useEffect, useRef } from 'react';
import { useTheme } from '@nextui-org/react';
import config from '../../../_config/index.json';
const { blogRepo } = config;
import { blogRepo } from '../../../_config';

const src = 'https://utteranc.es/client.js';
const LIGHT_THEME = 'github-light';
Expand Down
3 changes: 1 addition & 2 deletions apps/blog/src/components/Header/MainHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import Link from 'next/link';
import styled from '@emotion/styled';
import { Text, useTheme, config } from '@nextui-org/react';
import { KBarToggleButton, ThemeSwitch } from 'core';
import jsonConfig from '../../../_config/index.json';
const { blogName } = jsonConfig;
import { blogName } from '../../../_config';

function MainHeader() {
const { theme, isDark } = useTheme();
Expand Down
3 changes: 1 addition & 2 deletions apps/blog/src/components/Header/PostHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import Link from 'next/link';
import styled from '@emotion/styled';
import { Text, useTheme } from '@nextui-org/react';
import { KBarToggleButton, ThemeSwitch } from 'core';
import config from '../../../_config/index.json';
const { blogName } = config;
import { blogName } from '../../../_config';

function PostHeader() {
const { theme, isDark } = useTheme();
Expand Down
3 changes: 1 addition & 2 deletions apps/blog/src/components/SEO/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Head from 'next/head';
import { authorName, defaultMetaBackground } from 'core/constants';
import config from '../../../_config/index.json';
const { blogName, blogDescription } = config;
import { blogName, blogDescription } from '../../../_config';

interface Props {
title?: string | undefined;
Expand Down
5 changes: 1 addition & 4 deletions apps/blog/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import Document, { Html, Head, Main, NextScript } from 'next/document';
import { CssBaseline } from '@nextui-org/react';
import { Footer, GlobalStyle, Layout } from 'core';
import { authorName, blogGAID, blogHotjarID, favicon } from 'core/constants';

// Should not import the named export from default-exporting module (only default export is available soon)
import config from '../../_config/index.json';
const { blogUrl } = config;
import { blogUrl } from '../../_config';

function isValid(value: any) {
if (typeof value === 'string' && value.length > 0) return true;
Expand Down
5 changes: 5 additions & 0 deletions apps/resume/_config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import jsonData from './index.json';

export const resumeUrl = jsonData.resumeUrl;
export const blogUrl = jsonData.blogUrl;
export const email = jsonData.email;
3 changes: 1 addition & 2 deletions apps/resume/src/constants/KbarActions/KbarActions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IconActionType, socialActions } from 'core/constants';
import { openExternalLink } from 'core/utils';
import config from '../../../_config/index.json';
const { blogUrl, email } = config;
import { blogUrl, email } from '../../../_config';

function openEmailTo(href: string) {
Object.assign(document.createElement('a'), { href: `mailto:${href}` }).click();
Expand Down
3 changes: 3 additions & 0 deletions apps/resume/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CssBaseline } from '@nextui-org/react';
import { Footer, GlobalStyle, Layout } from 'core';
import { authorImage, authorName, favicon } from 'core/constants';
import { data } from '../../_content/Header';
import { resumeUrl } from '../../_config';

const TITLE = `${authorName} resume`;
export default class ResumeDocument extends Document {
Expand All @@ -17,10 +18,12 @@ export default class ResumeDocument extends Document {
<meta httpEquiv="Content-type" content="text/html; charset=utf-8" />
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta name="description" content={data.description} />
<link rel="canonical" href={resumeUrl} />
<meta name="keywords" content="resume,development,developer" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="ko_KR" />
<meta property="og:title" content={TITLE} />
<meta property="og:url" content={resumeUrl} />
<meta property="og:description" content={data.description} />
<meta property="og:image" content={authorImage.default.src} />
{/* for korean keywords */}
Expand Down