From f3f88848e0d57786cc9f37f6ba706feb0d23ae44 Mon Sep 17 00:00:00 2001 From: developomp Date: Sun, 17 Apr 2022 22:39:57 +0900 Subject: [PATCH] fixed url locale prefix related errors --- src/components/Navbar/Navbar.tsx | 10 ++++++++-- src/components/Navbar/SearchButton.tsx | 9 +++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/components/Navbar/Navbar.tsx b/src/components/Navbar/Navbar.tsx index 955695d..d10f072 100644 --- a/src/components/Navbar/Navbar.tsx +++ b/src/components/Navbar/Navbar.tsx @@ -1,3 +1,4 @@ +import { useContext } from "react" import styled from "styled-components" import { Link } from "react-router-dom" @@ -10,6 +11,8 @@ import Sidebar from "../Sidebar" import theming from "../../styles/theming" +import { globalContext } from "../../globalContext" + const StyledNav = styled.nav` /* set z index to arbitrarily high value to prevent other components from drawing over the navbar */ z-index: 9999; @@ -60,12 +63,15 @@ export const StyledLink = styled.div` ` const Navbar = () => { + const { globalState } = useContext(globalContext) + const { locale } = globalState + return ( {/* icon */} - - + + {/* nav links */} diff --git a/src/components/Navbar/SearchButton.tsx b/src/components/Navbar/SearchButton.tsx index 4e254bd..5da8d31 100644 --- a/src/components/Navbar/SearchButton.tsx +++ b/src/components/Navbar/SearchButton.tsx @@ -11,22 +11,19 @@ import { globalContext } from "../../globalContext" const SearchButton = () => { const { globalState } = useContext(globalContext) + const { locale } = globalState return ( <>
- +
- {globalState.locale == "en" ? "Search" : "검색"} + {locale == "en" ? "Search" : "검색"} )