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

chore(tech-blog): 기술 블로그 스캐폴딩 및 기본 config #106

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
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
9 changes: 9 additions & 0 deletions apps/tech-blog/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/** @type {import("eslint").Linter.Config} */
module.exports = {
root: true,
extends: ['@sambad/eslint-config/next.js'],
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
},
};
36 changes: 36 additions & 0 deletions apps/tech-blog/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
27 changes: 27 additions & 0 deletions apps/tech-blog/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 삼봤드의 모험 팀 기술 블로그 CONTRIBUTING

> 다음 방법에 따라 기술 블로그 작성을 해주세요

## 0. 개발 모드로 실행하기

> 아래 명령어를 통해 개발 모드로 작성 결과를 확인할 수 있습니다.

```bash
$ pnpm install
$ pnpm dev
```

## 1. 요약 카드 작성하기

> [작성하는 곳](https://github.com/depromeet/15th-team3-FE/blob/main/apps/tech-blog/constants/articles.ts)

양식에 맞게 작성해주세요

## 2. 글 추가하기

- pages 하위에 폴더/파일 명을 기반으로 라우팅 돼요.
- [예시 파일](https://github.com/depromeet/15th-team3-FE/blob/main/apps/tech-blog/pages/_temp.mdx)이에요. 해당 파일을 참고하여 제공하고 있는 양식에 맞게 작성해주세요.

## \* 권장사항

- 썸네일 사이즈는 `700*358`을 권장해요.
49 changes: 49 additions & 0 deletions apps/tech-blog/components/SummaryCard/SummaryCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { Txt } from '@sambad/sds/components';
import { borderRadiusVariants } from '@sds/theme';
import Image from 'next/image';
import { useRouter } from 'next/navigation';

import { generateDate } from '@/../utils/generateDate';

import { titleAttribute } from './constants';
import { containerCss, descriptionCss, textContainerCss, titleCss } from './styles';

export interface SummaryCardProps {
title: string;
description: string;
date: `${string}-${string}-${string}`;
writer: string;
thumbnail: string;
href: string;
}

export const SummaryCard = (props: SummaryCardProps) => {
const { title, description, date, writer, thumbnail, href } = props;
const router = useRouter();

return (
<div css={containerCss} onClick={() => router.push(href)}>
<div css={textContainerCss}>
<Txt typography="heading2" css={titleCss} {...titleAttribute.attribute}>
{title}
</Txt>
<Txt typography="title4" fontWeight="regular" css={descriptionCss}>
{description}
</Txt>
<Txt typography="title4" fontWeight="regular">
{generateDate(date)}
{' · '}
{writer}
</Txt>
</div>
<Image
src={thumbnail}
alt="thumbnail"
width={130}
height={90}
sizes="(max-width: 480px) 100px, 75px"
style={{ margin: 0, borderRadius: borderRadiusVariants.small }}
/>
</div>
);
};
7 changes: 7 additions & 0 deletions apps/tech-blog/components/SummaryCard/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const titleAttributeKey = 'data-sambad-title';
export const titleAttribute = {
attribute: {
[titleAttributeKey]: '',
},
querySelector: `[${titleAttributeKey}=""]`,
};
32 changes: 32 additions & 0 deletions apps/tech-blog/components/SummaryCard/styles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { css } from '@emotion/react';
import { colors, size } from '@sambad/sds/theme';

import { titleAttribute } from './constants';

export const containerCss = css({
padding: `${size['xs']} 0`,
display: 'flex',
cursor: 'pointer',

'&:hover': {
[`& ${titleAttribute.querySelector}`]: {
color: `${colors.tertiary500} !important`,
},
},
});

export const titleCss = css({
transition: 'color 0.1s ease-in-out',
marginBottom: size['7xs'],
});

export const descriptionCss = css({
marginBottom: size['3xs'],
});

export const textContainerCss = css({
width: '80%',
marginRight: size['2xs'],
display: 'flex',
flexDirection: 'column',
});
1 change: 1 addition & 0 deletions apps/tech-blog/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SummaryCard } from './SummaryCard/SummaryCard';
12 changes: 12 additions & 0 deletions apps/tech-blog/constants/articles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { SummaryCardProps } from '../components/SummaryCard/SummaryCard';

export const articles: Array<SummaryCardProps> = [
{
title: 'test',
description: '안녕하세요 이건 테스트입니다.',
date: '2024-08-17',
writer: '김테스터',
thumbnail: 'https://static.toss.im/illusts-content/tech-0812-cover3.png',
href: '/web/test',
},
];
1 change: 1 addition & 0 deletions apps/tech-blog/constants/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { articles } from './articles';
25 changes: 25 additions & 0 deletions apps/tech-blog/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-blog',
themeConfig: './theme.config.jsx',
});

const nextConfig = {
compiler: {
emotion: true,
},
transpilePackages: ['@sambad/sds'],
images: {
remotePatterns: [
{
protocol: 'https',
hostname: 'static.toss.im', // NOTE: 테스트를 위해 추가합니다.
},
{
protocol: 'https',
hostname: 'file.moring.one',
},
],
},
};

module.exports = withNextra(nextConfig);
30 changes: 30 additions & 0 deletions apps/tech-blog/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "tech-blog",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@emotion/react": "^11.11.4",
"@sambad/sds": "workspace:*",
"next": "14.2.5",
"nextra": "^2.13.4",
"nextra-theme-blog": "^2.13.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@sambad/eslint-config": "workspace:*",
"@sambad/typescript-config": "workspace:*",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.5",
"typescript": "^5"
}
}
6 changes: 6 additions & 0 deletions apps/tech-blog/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import '../styles.css';
import { AppProps } from 'next/app';

export default function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
20 changes: 20 additions & 0 deletions apps/tech-blog/pages/_temp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Badge } from '@sambad/sds/components';
import { colors } from '@sambad/sds/theme';
import { RenderArticleBase } from '@/../utils/RenderArticleBase';

{RenderArticleBase({
title: '디프만 1등 하기',
tags: ['Web', '테스트', '뱃지'],
writer: '김테스터',
role: 'Frontend Developer',
date: '2024-09-14',
thumbnail: 'https://static.toss.im/illusts-content/tech-0812-cover3.png',
})}

지금부터는 글을 쓰면 됩니다.

```tsx
<Foo content="code도 쓸 수 있어요" theme="테마도 알아서 먹힙니다" />
```

**마크다운** `문법`입니다.
7 changes: 7 additions & 0 deletions apps/tech-blog/pages/design/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# design test

```
/design/test
```

로 라우팅 됩니다.
10 changes: 10 additions & 0 deletions apps/tech-blog/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { SummaryCard } from '@/../components';
import { articles } from '@/../constants';

<img src="https://file.moring.one/defaults/banner.png" style={{ borderRadius: '8px' }} />

<div>
{articles.map((ariticle) => (
<SummaryCard {...ariticle} />
))}
</div>
7 changes: 7 additions & 0 deletions apps/tech-blog/pages/server/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# server test

```
/server/test
```

로 라우팅 됩니다.
20 changes: 20 additions & 0 deletions apps/tech-blog/pages/web/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Badge } from '@sambad/sds/components';
import { colors } from '@sambad/sds/theme';
import { RenderArticleBase } from '@/../utils/RenderArticleBase';

{RenderArticleBase({
title: '디프만 1등 하기',
tags: ['Web', '테스트', '뱃지'],
writer: '김테스터',
role: 'Frontend Developer',
date: '2024-09-14',
thumbnail: 'https://static.toss.im/illusts-content/tech-0812-cover3.png',
})}

지금부터는 글을 쓰면 됩니다.

```tsx
<Foo content="code도 쓸 수 있어요" theme="테마도 알아서 먹힙니다" />
```

**마크다운** `문법`입니다.
Binary file added apps/tech-blog/public/favicon.ico
Binary file not shown.
21 changes: 21 additions & 0 deletions apps/tech-blog/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
h1 {
margin-bottom: 0 !important;
}

img {
margin: 0 !important;
}

/* NOTE: 블로그 최대너비 오버라이드 하여 커스텀 */
.nx-prose {
max-width: 90ch !important;
}

/* NOTE: article 영역 padding-top 오버라이드 하여 커스텀 */
article {
padding-top: 2rem !important;
}

article > h1:first-child {
display: none;
}
13 changes: 13 additions & 0 deletions apps/tech-blog/theme.config.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default {
head: () => (
<>
<title>삼봤드의 모험 팀 기술 블로그</title>
<link rel="icon" href="/favicon.ico" />
<meta name="description" content="삼봤드의 모험 팀의 개발과 디자인에 대한 이야기를 다룹니다." />
<meta property="og:title" content="삼봤드의 모험 팀 기술 블로그" />
<meta property="og:description" content="삼봤드의 모험 팀의 개발과 디자인에 대한 이야기를 다룹니다." />
<meta property="og:image" content="https://file.moring.one/defaults/og-image.png" />
</>
),
footer: '',
};
11 changes: 11 additions & 0 deletions apps/tech-blog/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "@sambad/typescript-config/nextjs.json",
"compilerOptions": {
"paths": {
"@/*": ["./pages/*"],
"@sds/*": ["../../packages/core/sds/src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
Loading