Skip to content

Commit dd56904

Browse files
committed
Feat: TeamNavigation에 props를 추가하다
1 parent 5be8b13 commit dd56904

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/components/common/TeamNavigationTabs/TeamNavigationTabs.component.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import * as Styled from './TeamNavigationTabs.styled';
44

55
const TEAMS = ['All', 'Design', 'Android', 'iOS', 'Web', 'Node', 'Spring'];
66

7-
const TeamNavigationTabs = () => {
7+
interface TeamNavigationTabsProps {
8+
allAltText?: string;
9+
}
10+
11+
const TeamNavigationTabs = ({ allAltText }: TeamNavigationTabsProps) => {
812
const [searchParams, setSearchParams] = useSearchParams();
913

1014
const handleClickTab = (teamParam: string) => {
@@ -23,17 +27,18 @@ const TeamNavigationTabs = () => {
2327
const teamParam = team === 'All' ? '' : team.toUpperCase();
2428
const active =
2529
team === 'All' ? !searchParams.has('team') : searchParams.get('team') === teamParam;
26-
30+
const isAllAltText = team === 'All' && !!allAltText;
2731
return (
2832
<Styled.Tab
2933
key={index}
3034
role="link"
3135
aria-label={`${team} tab`}
3236
aria-current={active}
3337
active={active}
38+
isAllAltText={isAllAltText}
3439
onClick={() => handleClickTab(teamParam)}
3540
>
36-
{team}
41+
{isAllAltText ? allAltText : team}
3742
</Styled.Tab>
3843
);
3944
})}

src/components/common/TeamNavigationTabs/TeamNavigationTabs.styled.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
33

44
interface StyledNavigationItemProps {
55
active: boolean;
6+
isAllAltText?: boolean;
67
}
78

89
export const Tabs = styled.nav`
@@ -15,13 +16,13 @@ export const Tabs = styled.nav`
1516
`;
1617

1718
export const Tab = styled.button<StyledNavigationItemProps>`
18-
${({ theme, active }) => css`
19+
${({ theme, active, isAllAltText }) => css`
1920
${theme.fonts.regular16};
2021
2122
display: flex;
2223
align-items: center;
2324
justify-content: center;
24-
width: 8rem;
25+
width: ${isAllAltText ? '12rem' : '8rem'};
2526
height: 4rem;
2627
color: ${active ? theme.colors.purple70 : theme.colors.gray50};
2728
letter-spacing: -0.08rem;

0 commit comments

Comments
 (0)