PostList update
- changed component name from `PostList` to `Home` - removed props - added basic localization
This commit is contained in:
parent
33e6e26c6f
commit
7fbe466036
3 changed files with 11 additions and 12 deletions
|
@ -8,7 +8,7 @@ import Loading from "./components/Loading"
|
||||||
import Navbar from "./components/Navbar"
|
import Navbar from "./components/Navbar"
|
||||||
import Footer from "./components/Footer"
|
import Footer from "./components/Footer"
|
||||||
|
|
||||||
import PostList from "./pages/PostList"
|
import Home from "./pages/Home"
|
||||||
import Search from "./pages/Search"
|
import Search from "./pages/Search"
|
||||||
import Page from "./pages/Page"
|
import Page from "./pages/Page"
|
||||||
import NotFound from "./pages/NotFound"
|
import NotFound from "./pages/NotFound"
|
||||||
|
@ -80,7 +80,7 @@ export default function App() {
|
||||||
<Loading />
|
<Loading />
|
||||||
) : (
|
) : (
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/" element={<PostList title="Home" />} />
|
<Route path="/" element={<Home />} />
|
||||||
<Route path="/search" element={<Search />} />
|
<Route path="/search" element={<Search />} />
|
||||||
<Route path="/portfolio" element={<Portfolio />} />
|
<Route path="/portfolio" element={<Portfolio />} />
|
||||||
<Route path="/404" element={<NotFound />} />
|
<Route path="/404" element={<NotFound />} />
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* show posts in recent order
|
* show posts in recent order
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { useEffect, useState } from "react"
|
import { useContext, useEffect, useState } from "react"
|
||||||
import { Helmet } from "react-helmet-async"
|
import { Helmet } from "react-helmet-async"
|
||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ import ShowMoreButton from "./ShowMoreButton"
|
||||||
import _map from "../../data/map.json"
|
import _map from "../../data/map.json"
|
||||||
import theming from "../../styles/theming"
|
import theming from "../../styles/theming"
|
||||||
|
|
||||||
import { Map } from "../../../types/types"
|
import { globalContext } from "../../globalContext"
|
||||||
|
|
||||||
|
import type { Map } from "../../../types/types"
|
||||||
|
|
||||||
const map: Map = _map
|
const map: Map = _map
|
||||||
|
|
||||||
|
@ -27,11 +29,8 @@ const StyledPostList = styled.div`
|
||||||
})};
|
})};
|
||||||
`
|
`
|
||||||
|
|
||||||
interface Props {
|
const PostList = () => {
|
||||||
title: string
|
const { globalState } = useContext(globalContext)
|
||||||
}
|
|
||||||
|
|
||||||
const PostList = (props: Props) => {
|
|
||||||
const [howMany, setHowMany] = useState(5)
|
const [howMany, setHowMany] = useState(5)
|
||||||
const [postsLength, setPostsLength] = useState(0)
|
const [postsLength, setPostsLength] = useState(0)
|
||||||
const [postCards, setPostCards] = useState<JSX.Element[]>([])
|
const [postCards, setPostCards] = useState<JSX.Element[]>([])
|
||||||
|
@ -67,17 +66,17 @@ const PostList = (props: Props) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Helmet>
|
<Helmet>
|
||||||
<title>pomp | {props.title}</title>
|
<title>pomp | Home</title>
|
||||||
|
|
||||||
<meta property="og:title" content={props.title} />
|
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta
|
<meta
|
||||||
property="og:image"
|
property="og:image"
|
||||||
content={`${process.env.PUBLIC_URL}/icon/icon.svg`}
|
content={`${process.env.PUBLIC_URL}/icon/icon.svg`}
|
||||||
/>
|
/>
|
||||||
</Helmet>
|
</Helmet>
|
||||||
|
|
||||||
<StyledPostList>
|
<StyledPostList>
|
||||||
<h1>Recent Posts</h1>
|
<h1>{globalState.locale == "en" ? "Recent Posts" : "최근 포스트"}</h1>
|
||||||
{postCards}
|
{postCards}
|
||||||
{postsLength > howMany && (
|
{postsLength > howMany && (
|
||||||
<ShowMoreButton
|
<ShowMoreButton
|
Loading…
Add table
Add a link
Reference in a new issue