Skip to content

Commit

Permalink
fix: 플로팅 버튼과 카드 리스트 겹치는 에러 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
healim01 committed Jul 31, 2024
1 parent e28207f commit 4c1e45e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion frontend/src/components/common/Button/FloatingButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ type Color = 'yellow' | 'green' | 'subGreen';

interface Props extends React.HTMLAttributes<HTMLButtonElement> {
children: React.ReactNode;
onClick: () => void;
size?: Size;
color?: Color;
'aria-label'?: string;
}

const FloatingButton = ({
children,
onClick,
size = 'medium',
color = 'yellow',
'aria-label': ariaLabel = 'add',
...rest
}: Props) => {
return (
<S.Wrapper>
<S.Button size={size} color={color} aria-label={ariaLabel} {...rest}>
<S.Button size={size} color={color} aria-label={ariaLabel} onClick={onClick} {...rest}>
{children}
</S.Button>
</S.Wrapper>
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/pages/ChecklistListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { useEffect, useState } from 'react';
import { Link, useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';

import { getChecklists } from '@/apis/checklist';
import { Plus } from '@/assets/assets';
Expand Down Expand Up @@ -46,6 +46,10 @@ const ChecklistListPage = () => {
});
};

const handleClickFloatingButton = () => {
navigate(ROUTE_PATH.checklistNew);
};

return (
<>
<Header center={<Header.Text>체크리스트</Header.Text>} />
Expand All @@ -61,11 +65,9 @@ const ChecklistListPage = () => {
))}
</S.ListBox>
</Layout>
<Link to={ROUTE_PATH.checklistNew}>
<FloatingButton>
<Plus />
</FloatingButton>
</Link>
<FloatingButton onClick={handleClickFloatingButton}>
<Plus />
</FloatingButton>
<FooterDefault />
</>
);
Expand Down

0 comments on commit 4c1e45e

Please sign in to comment.