Skip to content

Commit

Permalink
feat: Header 번역 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
KimJi-An committed Nov 6, 2024
1 parent 078733a commit 03313f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/assets/translator/Header/headerData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Languages } from '../Languages';

export const headerData = {
[Languages.KO]: {
post_notice: '채용공고 등록',
login: '로그인',
logout: '로그아웃',
},
[Languages.VE]: {
post_notice: 'Đăng thông báo tuyển dụng',
login: 'Đăng nhập',
logout: 'Đăng xuất',
},
};
3 changes: 3 additions & 0 deletions src/assets/translator/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { applicantsData } from './Applicants/applicantsData';
import { contractModalData } from './Applicants/ContractModal/contractModalData';
import { employerMyPageData } from './EmployerMyPage/employerMyPageData';
import { headerData } from './Header/headerData';
import { Languages } from './Languages';
import { myCompanyData } from './MyCompany/myCompanyData';
import { registerVisaData } from './RegisterVisa/registerVisaData';
Expand All @@ -13,6 +14,7 @@ export const KO = {
applicants: { ...applicantsData[Languages.KO] },
registerVisa: { ...registerVisaData[Languages.KO] },
contractModal: { ...contractModalData[Languages.KO] },
header: { ...headerData[Languages.KO] },
};

export const VE = {
Expand All @@ -22,4 +24,5 @@ export const VE = {
applicants: { ...applicantsData[Languages.VE] },
registerVisa: { ...registerVisaData[Languages.VE] },
contractModal: { ...contractModalData[Languages.VE] },
header: { ...headerData[Languages.VE] },
};
8 changes: 5 additions & 3 deletions src/features/layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ import { useNavigate } from 'react-router-dom';
import ROUTE_PATH from '@/routes/path';
import { useUser } from '@/components/providers/User.provider';
import { userLocalStorage } from '@/utils/storage';
import { useTranslation } from 'react-i18next';

export default function Header() {
const navigate = useNavigate();
const [menuOpen, toggleMenu] = useToggle();
const { user, setUser } = useUser();
const { t } = useTranslation();

const goToHome = () => {
startTransition(() => {
Expand Down Expand Up @@ -65,20 +67,20 @@ export default function Header() {
<LanguageFilter />
{!user ? (
<Button style={customButtonStyle} onClick={login}>
로그인
{t('header.login')}
</Button>
) : (
<>
{user.type === 'employer' && (
<Button design="outlined" style={commonButtonStyle} onClick={goToPostNotice}>
채용공고 등록
{t('header.post_notice')}
</Button>
)}
<Flex justifyContent="center" alignItems="center" onClick={goToMyPage}>
<Image url={user.profileImage} size={{ width: '40px', height: '40px' }} css={imageStyle} />
</Flex>
<Button style={customButtonStyle} onClick={logout}>
로그아웃
{t('header.logout')}
</Button>
</>
)}
Expand Down

0 comments on commit 03313f2

Please sign in to comment.