Skip to content

Commit

Permalink
feat(layout): Add title history back
Browse files Browse the repository at this point in the history
  • Loading branch information
1ilsang committed Aug 19, 2023
1 parent 439c066 commit eba5bf1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/features/shared/layout/components/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
import { useAtom } from 'jotai';
import { FunctionComponent } from 'react';
import { useNavigate } from 'react-router-dom';

import { titleAtom } from '../atom';

import backLogo from '/svg/back.svg';

const LayoutTitle: FunctionComponent = () => {
const [{ title, back }] = useAtom(titleAtom);
const navigate = useNavigate();

const handleBackClick = () => {
navigate(-1);
};

if (!title) return <div className="layout-title" />;

return (
<div className="layout-title under-line">
<div className="left">
{back && <img src={backLogo} alt="Back Logo" />}
{back && (
<img src={backLogo} alt="Back Logo" onClick={handleBackClick} />
)}
</div>
<div className="title">{title}</div>
<div className="left" />
Expand Down

0 comments on commit eba5bf1

Please sign in to comment.