Skip to content

Commit 2b9af1f

Browse files
Merge pull request #4 from easy-deep-learning/feature/init-nextjs
Init project
2 parents 47e7811 + b18bb48 commit 2b9af1f

29 files changed

+3795
-0
lines changed

.eslintrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "next/core-web-vitals"
3+
}

.github/workflows/build.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: deploy
2+
on: [push]
3+
jobs:
4+
build:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout
8+
uses: actions/checkout@v3
9+
10+
- name: Setup Node.js environment
11+
uses: actions/[email protected]
12+
with:
13+
node-version: '16'
14+
15+
- uses: pnpm/[email protected]
16+
with:
17+
version: 7.12.2
18+
19+
- name: Install dependencies
20+
run: pnpm install
21+
22+
- name: Build
23+
run: pnpm run build
24+
25+
- name: Static HTML Export
26+
run: pnpm run export
27+
28+
- name: Disable Jekyl # https://github.blog/2009-12-29-bypassing-jekyll-on-github-pages/
29+
run: touch ./out/.nojekyll
30+
31+
- name: Delpoy 🚀
32+
uses: JamesIves/[email protected]
33+
with:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
BRANCH: gh-pages
36+
FOLDER: out

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# next.js
12+
/.next/
13+
/out/
14+
15+
# production
16+
/build
17+
18+
# misc
19+
.DS_Store
20+
*.pem
21+
22+
# debug
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*
26+
.pnpm-debug.log*
27+
28+
# local env files
29+
.env*.local
30+
31+
# vercel
32+
.vercel
33+
34+
# typescript
35+
*.tsbuildinfo
36+
next-env.d.ts

components/Date/date.jsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { parseISO, format } from 'date-fns'
2+
import { ru } from 'date-fns/locale'
3+
import dateStyles from './date.module.css'
4+
5+
6+
export default function Date({ dateString }) {
7+
const date = parseISO(dateString)
8+
return (
9+
<time dateTime={dateString} className="date">
10+
<span className={dateStyles.day}>{format(date, 'dd', { locale: ru })}</span>
11+
<span className={dateStyles.month}>{format(date, 'mm', { locale: ru })}</span>
12+
<span className={dateStyles.year}>{format(date, 'yyyy', { locale: ru })}</span>
13+
</time>
14+
)
15+
}

components/Date/date.module.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.day {}
2+
3+
.month {}
4+
5+
.year {}

components/Date/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Date from './date'
2+
3+
export { Date }

components/Header/Header.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Menu } from '../index'
2+
3+
export default function Header () {
4+
return (
5+
<header>
6+
<Menu />
7+
</header>
8+
)
9+
}

components/Header/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Header from './Header'
2+
3+
export { Header }

components/Menu/Menu.jsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import React from 'react'
2+
import Link from 'next/link'
3+
import { withRouter } from 'next/router'
4+
import style from './menu.module.css'
5+
6+
const ActiveLink = withRouter(({ router, children, ...props }) => (
7+
<Link {...props}>
8+
{React.cloneElement(children, {
9+
className: router.pathname === props.href ? `${style.item} ${style.item_active}` : style.item,
10+
})}
11+
</Link>
12+
))
13+
14+
export default function Menu () {
15+
return (
16+
<nav className={style.root}>
17+
<ActiveLink href="/"><a>Главная</a></ActiveLink>
18+
<ActiveLink href="/text-works"><a>Тестовые задания</a></ActiveLink>
19+
<ActiveLink href="/programming"><a>Программирование</a></ActiveLink>
20+
<ActiveLink href="/ci-cd"><a>Деплой</a></ActiveLink>
21+
<ActiveLink href="/soft-skills"><a>Софт-Скиллы</a></ActiveLink>
22+
</nav>
23+
)
24+
}

components/Menu/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import Menu from './Menu'
2+
3+
export { Menu }

0 commit comments

Comments
 (0)