|
@ -1,11 +1,12 @@ |
|
|
import { css, cx } from "@emotion/css"; |
|
|
import { css } from "@emotion/css"; |
|
|
import React, { useEffect, useState } from "react"; |
|
|
import React, { useEffect, useState } from "react"; |
|
|
import { Routes, Route, Link, useLocation } from "react-router-dom"; |
|
|
import { Link, useLocation } from "react-router-dom"; |
|
|
import { Spacer } from "../../components/Spacer"; |
|
|
import { Spacer } from "../../components/Spacer"; |
|
|
import { ArticleSubHeader } from "./components/ArticleSubHeader"; |
|
|
import { ArticleSubHeader } from "./components/ArticleSubHeader"; |
|
|
import { BlogPost } from "./components/BlogContent"; |
|
|
import { BlogPost } from "./components/BlogContent"; |
|
|
import { articles, getBlogPath } from "../../data"; |
|
|
import { articles, getBlogPath } from "../../data"; |
|
|
import { ReactComponent as DrawClose } from "../../assets/draw-close.svg"; |
|
|
import { ReactComponent as DrawClose } from "../../assets/draw-close.svg"; |
|
|
|
|
|
import classNames from "classnames"; |
|
|
|
|
|
|
|
|
const Header: React.FC = () => { |
|
|
const Header: React.FC = () => { |
|
|
return ( |
|
|
return ( |
|
@ -69,7 +70,9 @@ const BlogHome: React.FC = () => { |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<div |
|
|
<div |
|
|
className={cx( |
|
|
data-home |
|
|
|
|
|
key="blog-home" |
|
|
|
|
|
className={classNames( |
|
|
{ "article-open": isArticleOpen, "aside-closed": isAsideClosed }, |
|
|
{ "article-open": isArticleOpen, "aside-closed": isAsideClosed }, |
|
|
css` |
|
|
css` |
|
|
display: flex; |
|
|
display: flex; |
|
@ -77,6 +80,7 @@ const BlogHome: React.FC = () => { |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
width: 100vw; |
|
|
width: 100vw; |
|
|
overflow: hidden; |
|
|
overflow: hidden; |
|
|
|
|
|
position: relative; |
|
|
|
|
|
|
|
|
@media screen and (max-width: 80rem) { |
|
|
@media screen and (max-width: 80rem) { |
|
|
div& > .draw-ctl { |
|
|
div& > .draw-ctl { |
|
@ -101,69 +105,64 @@ const BlogHome: React.FC = () => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
& > aside { |
|
|
|
|
|
transition: all 250ms; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
&:is(.aside-closed) { |
|
|
&:is(.aside-closed) { |
|
|
aside { |
|
|
aside { |
|
|
max-width: 0; |
|
|
max-width: 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
`,
|
|
|
& > aside, |
|
|
)}> |
|
|
& > article { |
|
|
<button |
|
|
transition: all 250ms; |
|
|
onClick={() => setAsideClosed(closed => !closed)} |
|
|
|
|
|
className={classNames( |
|
|
@media screen and (max-width: 50rem) { |
|
|
css` |
|
|
padding-block-start: 4rem; |
|
|
|
|
|
padding-block-end: 6rem; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
& > .draw-ctl { |
|
|
|
|
|
border: none; |
|
|
border: none; |
|
|
padding: 1rem; |
|
|
padding: 1rem; |
|
|
padding-block: 10vw; |
|
|
padding-block: 10vw; |
|
|
display: flex; |
|
|
display: flex; |
|
|
min-width: 3.6rem; |
|
|
min-width: 3.6rem; |
|
|
max-width: 3.6rem; |
|
|
max-width: 3.6rem; |
|
|
} |
|
|
transition: background-color 100ms; |
|
|
`,
|
|
|
background-color: #262626; |
|
|
)}> |
|
|
position: absolute; |
|
|
{isArticleOpen ? ( |
|
|
width: 100%; |
|
|
<button |
|
|
height: 100%; |
|
|
onClick={() => setAsideClosed(closed => !closed)} |
|
|
transition: transform 300ms; |
|
|
className={cx( |
|
|
|
|
|
"draw-ctl", |
|
|
|
|
|
css` |
|
|
|
|
|
transition: background-color 100ms; |
|
|
|
|
|
background-color: #262626; |
|
|
|
|
|
|
|
|
|
|
|
&:hover { |
|
|
&:hover { |
|
|
background-color: #323232; |
|
|
background-color: #323232; |
|
|
} |
|
|
} |
|
|
|
|
|
`,
|
|
|
|
|
|
!isArticleOpen && |
|
|
|
|
|
css` |
|
|
|
|
|
transform: translateX(-100%); |
|
|
`,
|
|
|
`,
|
|
|
)}> |
|
|
)}> |
|
|
<DrawClose |
|
|
<DrawClose |
|
|
width="2.6rem" |
|
|
width="2.6rem" |
|
|
className={cx( |
|
|
className={classNames( |
|
|
css` |
|
|
css` |
|
|
transition: transform 100ms; |
|
|
transition: transform 100ms; |
|
|
`,
|
|
|
`,
|
|
|
{ |
|
|
{ |
|
|
[css` |
|
|
[css` |
|
|
transform: rotate(180deg); |
|
|
transform: rotate(180deg); |
|
|
`]: isAsideClosed,
|
|
|
`]: isAsideClosed,
|
|
|
}, |
|
|
}, |
|
|
)} |
|
|
)} |
|
|
/> |
|
|
/> |
|
|
</button> |
|
|
</button> |
|
|
) : ( |
|
|
|
|
|
<div className="draw-ctl"></div> |
|
|
|
|
|
)} |
|
|
|
|
|
<aside |
|
|
<aside |
|
|
className={css` |
|
|
className={css` |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
flex: 2; |
|
|
flex: 2; |
|
|
max-width: 45rem; |
|
|
max-width: 45rem; |
|
|
|
|
|
margin-inline-start: 3.6rem; |
|
|
`}>
|
|
|
`}>
|
|
|
<div |
|
|
<div |
|
|
className={css` |
|
|
className={css` |
|
@ -175,6 +174,11 @@ const BlogHome: React.FC = () => { |
|
|
gap: 1rem; |
|
|
gap: 1rem; |
|
|
padding: 8vw; |
|
|
padding: 8vw; |
|
|
min-width: 30rem; |
|
|
min-width: 30rem; |
|
|
|
|
|
|
|
|
|
|
|
@media screen and (max-width: 50rem) { |
|
|
|
|
|
padding-block-start: 4rem; |
|
|
|
|
|
padding-block-end: 6rem; |
|
|
|
|
|
} |
|
|
`}>
|
|
|
`}>
|
|
|
<Header /> |
|
|
<Header /> |
|
|
<Spacer y={2} /> |
|
|
<Spacer y={2} /> |
|
@ -218,31 +222,56 @@ const BlogHome: React.FC = () => { |
|
|
</div> |
|
|
</div> |
|
|
</aside> |
|
|
</aside> |
|
|
<article |
|
|
<article |
|
|
className={cx( |
|
|
className={classNames( |
|
|
{ "article-open": isArticleOpen }, |
|
|
{ "article-open": isArticleOpen }, |
|
|
css` |
|
|
css` |
|
|
height: 100%; |
|
|
height: 100%; |
|
|
width: 100%; |
|
|
width: 100%; |
|
|
flex: 3; |
|
|
flex: 3; |
|
|
z-index: 1000; |
|
|
z-index: 1000; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
position: relative; |
|
|
|
|
|
overflow: hidden; |
|
|
|
|
|
|
|
|
|
|
|
& > * { |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
} |
|
|
`,
|
|
|
`,
|
|
|
)}> |
|
|
)}> |
|
|
<div |
|
|
<div |
|
|
className={css` |
|
|
key="blog-content" |
|
|
height: 100%; |
|
|
className={classNames( |
|
|
width: 100%; |
|
|
css` |
|
|
overflow-y: auto; |
|
|
background-color: #262626; |
|
|
overflow-x: hidden; |
|
|
position: absolute; |
|
|
padding: 8vw; |
|
|
transition: all 300ms; |
|
|
background-color: #262626; |
|
|
transform: translateX(100%); |
|
|
display: flex; |
|
|
|
|
|
flex-direction: column; |
|
|
@media screen and (max-width: 50rem) { |
|
|
gap: 1.5rem; |
|
|
padding-block-start: 4rem; |
|
|
`}>
|
|
|
padding-block-end: 6rem; |
|
|
<Routes> |
|
|
} |
|
|
<Route path="/" element={<div></div>} /> |
|
|
`,
|
|
|
<Route path="/*" element={<BlogPost />} /> |
|
|
{ |
|
|
</Routes> |
|
|
[css` |
|
|
|
|
|
transform: translateX(0%); |
|
|
|
|
|
`]: isArticleOpen,
|
|
|
|
|
|
}, |
|
|
|
|
|
)}> |
|
|
|
|
|
<div |
|
|
|
|
|
className={css` |
|
|
|
|
|
height: 100%; |
|
|
|
|
|
width: 100%; |
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
overflow-x: hidden; |
|
|
|
|
|
display: flex; |
|
|
|
|
|
flex-direction: column; |
|
|
|
|
|
padding: 8vw; |
|
|
|
|
|
gap: 1.5rem; |
|
|
|
|
|
`}>
|
|
|
|
|
|
{isArticleOpen && <BlogPost />} |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</article> |
|
|
</article> |
|
|
</div> |
|
|
</div> |
|
|