Skip to content

Commit

Permalink
fix: header backbutton onClick event 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeseon-han committed Jan 29, 2024
1 parent 96ac08a commit ff45f46
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/organisms/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useMemo } from 'react';

import { AngleIcon } from '@/assets/icons';
import { useRouter } from 'next/router';

const Header: React.FC<{
headerLeft?: React.ReactElement<
Expand All @@ -14,6 +15,8 @@ const Header: React.FC<{
>;
backgroundColor?: 'gray1' | 'white' | 'transparent';
}> = ({ headerLeft, headerTitle, headerRight, backgroundColor }) => {
const router = useRouter();

const background = useMemo(() => {
switch (backgroundColor) {
case 'gray1':
Expand All @@ -32,15 +35,15 @@ const Header: React.FC<{
className={`flex justify-center items-center fixed top-0 w-screen max-w-[480px] py-[12px] px-[20px] z-[1000] ${background}`}
>
{headerLeft ?? (
<div
<button
onClick={() => {
window.history.back();
router.back();
}}
>
<AngleIcon
fill={backgroundColor === 'transparent' ? '#FFFFFF' : '#363A45'}
/>
</div>
</button>
)}
<div className="flex justify-center text-center w-full">
<p className="heading3-bold text-gray8 pt-1">
Expand Down

0 comments on commit ff45f46

Please sign in to comment.