site restructuring

- navbar won't hide content when clicking headers and stuff
- using grid layout
This commit is contained in:
Kim, Jimin 2021-12-21 19:01:54 +09:00
parent f1482b1dff
commit 1135166391
7 changed files with 51 additions and 36 deletions

View file

@ -27,10 +27,20 @@ const IENotSupported = styled.p`
font-family: ${theming.font.regular}; font-family: ${theming.font.regular};
` `
const StyledContentContainer = styled.div` const StyledScrollableArea = styled.div`
flex: 1 1 auto; height: calc(100vh - 4rem);
display: flex;
flex-direction: column;
justify-content: space-between;
overflow-y: scroll;
overflow-x: hidden;
`
const StyedContentContainer = styled.div`
margin-top: 3rem;
margin-bottom: 3rem; margin-bottom: 3rem;
margin-top: 5rem;
` `
const App = () => { const App = () => {
@ -81,27 +91,28 @@ const App = () => {
<meta property="og:description" content="developomp's blog" /> <meta property="og:description" content="developomp's blog" />
<meta property="og:url" content={process.env.PUBLIC_URL} /> <meta property="og:url" content={process.env.PUBLIC_URL} />
</Helmet> </Helmet>
<GlobalStyle /> <GlobalStyle />
<Navbar /> <Navbar />
<StyledContentContainer> <StyledScrollableArea>
{isLoading ? ( <StyedContentContainer>
<Loading /> {isLoading ? (
) : ( <Loading />
<Routes> ) : (
<Route <Routes>
path="/" <Route
element={<PostList howMany={5} title="Home" />} path="/"
/> element={<PostList howMany={5} title="Home" />}
<Route path="/loading" element={<Loading />} /> />
<Route path="/search" element={<Search />} /> <Route path="/loading" element={<Loading />} />
<Route path="/404" element={<NotFound />} /> <Route path="/search" element={<Search />} />
<Route path="/*" element={<Page />} /> <Route path="/404" element={<NotFound />} />
</Routes> <Route path="/*" element={<Page />} />
)} </Routes>
</StyledContentContainer> )}
<Footer /> </StyedContentContainer>
<Footer />
</StyledScrollableArea>
</ThemeProvider> </ThemeProvider>
) )
} }

View file

@ -7,7 +7,10 @@ import theming from "../styles/theming"
const StyledFooter = styled.footer` const StyledFooter = styled.footer`
display: flex; display: flex;
height: 7.77rem; /* congratulation. You've found the lucky 777 */
// congratulation. You've found the lucky 7s
min-height: 7.77rem;
max-height: 7.77rem;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

View file

@ -4,7 +4,6 @@ import theming from "../styles/theming"
import Card from "./Card" import Card from "./Card"
export const mainContentCSS = css` export const mainContentCSS = css`
margin-top: 3rem;
width: 50%; width: 50%;
@media screen and (max-width: ${theming.size.screen_size1}) { @media screen and (max-width: ${theming.size.screen_size1}) {

View file

@ -16,7 +16,7 @@ import NavbarData from "../data/NavbarData"
const StyledNav = styled.nav` const StyledNav = styled.nav`
/* set z index to arbitrarily high value to prevent other components from drawing over the navbar */ /* set z index to arbitrarily high value to prevent other components from drawing over the navbar */
z-index: 9999; z-index: 9999;
position: fixed; max-height: 4rem;
width: 100%; width: 100%;
background-color: ${(props) => background-color: ${(props) =>

View file

@ -20,10 +20,6 @@ import { useEffect } from "react"
const map: Map = _map const map: Map = _map
const StyledPage = styled(MainContent)`
padding-top: 0;
`
const StyledTitle = styled.h1` const StyledTitle = styled.h1`
margin-bottom: 1rem; margin-bottom: 1rem;
` `
@ -134,7 +130,7 @@ const Page = () => {
/> />
</Helmet> </Helmet>
<StyledPage> <MainContent>
{isSeries ? ( {isSeries ? (
<NextPrevButtons <NextPrevButtons
prevURL={seriesData?.prev} prevURL={seriesData?.prev}
@ -176,7 +172,7 @@ const Page = () => {
__html: fetchedPage.content, __html: fetchedPage.content,
}} }}
/> />
</StyledPage> </MainContent>
</> </>
) )
} }

View file

@ -46,6 +46,7 @@ const defaultDateRange = [
const StyledSearch = styled(MainContent)` const StyledSearch = styled(MainContent)`
text-align: center; text-align: center;
margin-bottom: 2rem;
` `
const StyledSearchContainer = styled.div` const StyledSearchContainer = styled.div`
@ -277,6 +278,7 @@ const Search = () => {
</StyledSearchControlContainer> </StyledSearchControlContainer>
</StyledSearchContainer> </StyledSearchContainer>
</StyledSearch> </StyledSearch>
{postCards} {postCards}
</> </>
) )

View file

@ -209,15 +209,11 @@ const globalStyle = css`
${headerCSS} ${headerCSS}
${markCSS} ${markCSS}
${katexCSS} ${katexCSS}
body {
overflow-x: hidden;
overflow-y: scroll;
}
html, html,
body, body,
#root { #root {
overflow: hidden;
min-height: 100vh; min-height: 100vh;
margin: 0; margin: 0;
display: flex; display: flex;
@ -239,6 +235,14 @@ const globalStyle = css`
text-rendering: optimizeLegibility; text-rendering: optimizeLegibility;
} }
#root {
display: grid;
grid-template-rows: 4rem / auto;
height: 100vh;
width: 100vw;
}
a { a {
text-decoration: none; text-decoration: none;
color: ${theming.color.linkColor}; color: ${theming.color.linkColor};