Skip to content

Commit e668009

Browse files
authored
[FE] 탭 버튼 에러 핸들링을 추가한다. (#1059)
1 parent 043a983 commit e668009

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

frontend/src/components/NewChecklist/MoveNextButton.tsx

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useTabContext } from '@/components/_common/Tabs/TabContext';
55
import useTabs from '@/hooks/useTabs';
66
import useChecklistStore from '@/store/useChecklistStore';
77
import { flexRow } from '@/styles/common';
8-
import theme from '@/styles/theme';
98

109
interface Props {
1110
marginTop?: string;
@@ -23,11 +22,11 @@ const MoveNextButton = ({ marginTop = '0', marginBottom = '0' }: Props) => {
2322

2423
return (
2524
<S.ContentBox marginTop={marginTop} marginBottom={marginBottom}>
26-
<S.Button onClick={handleClickPrev}>
27-
<S.Text color={theme.palette.yellow600}>{'< 이전으로 이동'}</S.Text>
25+
<S.Button onClick={handleClickPrev} disabled={currentTabId === -1}>
26+
{`< 이전으로 이동`}
2827
</S.Button>
29-
<S.Button onClick={handleClickNext}>
30-
<S.Text color={theme.palette.yellow600}>{'다음으로 이동 >'}</S.Text>
28+
<S.Button onClick={handleClickNext} disabled={currentTabId === categories.length}>
29+
{'다음으로 이동 >'}
3130
</S.Button>
3231
</S.ContentBox>
3332
);
@@ -36,21 +35,24 @@ const MoveNextButton = ({ marginTop = '0', marginBottom = '0' }: Props) => {
3635
export default React.memo(MoveNextButton);
3736

3837
const S = {
39-
Text: styled.span<{ color: string }>`
40-
color: ${({ color }) => color};
41-
font-weight: ${({ theme }) => theme.text.weight.bold};
42-
`,
4338
Button: styled.button`
4439
margin: 10px 0;
4540
padding: 0 15px;
4641
border: 0.25rem solid ${({ theme }) => theme.palette.yellow400};
4742
4843
background-color: ${({ theme }) => theme.palette.white};
4944
50-
font-weight: ${({ theme }) => theme.text.weight.medium};
45+
color: ${({ theme }) => theme.palette.yellow600};
46+
font-weight: ${({ theme }) => theme.text.weight.bold};
5147
font-size: ${({ theme }) => theme.text.size.small};
5248
line-height: 2.5;
5349
border-radius: 3rem;
50+
51+
&:disabled {
52+
border: 0.25rem solid ${({ theme }) => theme.palette.grey300};
53+
54+
color: ${({ theme }) => theme.palette.grey500};
55+
}
5456
`,
5557
ContentBox: styled.div<{ marginTop: string; marginBottom: string }>`
5658
${flexRow}

0 commit comments

Comments
 (0)