fixed url locale prefix related errors
This commit is contained in:
parent
ac959933bb
commit
f3f88848e0
2 changed files with 11 additions and 8 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { useContext } from "react"
|
||||||
import styled from "styled-components"
|
import styled from "styled-components"
|
||||||
import { Link } from "react-router-dom"
|
import { Link } from "react-router-dom"
|
||||||
|
|
||||||
|
@ -10,6 +11,8 @@ import Sidebar from "../Sidebar"
|
||||||
|
|
||||||
import theming from "../../styles/theming"
|
import theming from "../../styles/theming"
|
||||||
|
|
||||||
|
import { globalContext } from "../../globalContext"
|
||||||
|
|
||||||
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;
|
||||||
|
@ -60,12 +63,15 @@ export const StyledLink = styled.div`
|
||||||
`
|
`
|
||||||
|
|
||||||
const Navbar = () => {
|
const Navbar = () => {
|
||||||
|
const { globalState } = useContext(globalContext)
|
||||||
|
const { locale } = globalState
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledNav>
|
<StyledNav>
|
||||||
<StyledContainer>
|
<StyledContainer>
|
||||||
{/* icon */}
|
{/* icon */}
|
||||||
<Link to="/">
|
<Link to={`/${locale}`}>
|
||||||
<StyledImg src={process.env.PUBLIC_URL + "/icon/icon_circle.svg"} />
|
<StyledImg src="/icon/icon_circle.svg" />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
{/* nav links */}
|
{/* nav links */}
|
||||||
|
|
|
@ -11,22 +11,19 @@ import { globalContext } from "../../globalContext"
|
||||||
|
|
||||||
const SearchButton = () => {
|
const SearchButton = () => {
|
||||||
const { globalState } = useContext(globalContext)
|
const { globalState } = useContext(globalContext)
|
||||||
|
const { locale } = globalState
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<Link
|
<Link data-tip data-for="search" to={`/${locale}/search`}>
|
||||||
data-tip
|
|
||||||
data-for="search"
|
|
||||||
to={`${process.env.PUBLIC_URL}/search`}
|
|
||||||
>
|
|
||||||
<StyledLink>
|
<StyledLink>
|
||||||
<FontAwesomeIcon icon={faSearch} />
|
<FontAwesomeIcon icon={faSearch} />
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<ReactTooltip id="search" type="dark" effect="solid">
|
<ReactTooltip id="search" type="dark" effect="solid">
|
||||||
<span>{globalState.locale == "en" ? "Search" : "검색"}</span>
|
<span>{locale == "en" ? "Search" : "검색"}</span>
|
||||||
</ReactTooltip>
|
</ReactTooltip>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue