Skip to content

Commit

Permalink
fix: isSelected $ 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Parkhanyoung committed Jul 25, 2024
1 parent 72bee76 commit 135243d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions frontend/src/components/Tab/Tab.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const CurrentContentContainer = styled.div`
animation: ${fadeIn} 0.3s ease-out;
`;

export const TabContainer = styled.div<{ isSelected: boolean }>`
export const TabContainer = styled.div<{ $isSelected: boolean }>`
padding: 10px 20px;
cursor: pointer;
background: ${({ isSelected }) => (isSelected ? 'var(--primary-700)' : 'var(--grey-700)')};
background: ${({ $isSelected }) => ($isSelected ? 'var(--primary-700)' : 'var(--grey-700)')};
font-size: 1.5rem;
color: white;
border-radius: 1rem 1rem 0 0;
Expand All @@ -39,15 +39,15 @@ export const TabContainer = styled.div<{ isSelected: boolean }>`
background 0.3s,
box-shadow 0.3s;
${({ isSelected }) =>
isSelected &&
${({ $isSelected }) =>
$isSelected &&
`
box-shadow: 0 0.4rem 0.8rem rgba(0, 0, 0, 0.2);
animation: tabSelected 0.3s ease-out;
`}
&:hover {
background: ${({ isSelected }) => (isSelected ? 'var(--primary-500)' : 'var(--grey-500)')};
background: ${({ $isSelected }) => ($isSelected ? 'var(--primary-500)' : 'var(--grey-500)')};
}
@keyframes tabSelected {
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/components/Tab/TabHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ interface TabProps extends PropsWithChildren {
export default function TabHeader({ index, children }: TabProps) {
const { selectedIndex, handleSelectedIndex } = useTabs();
return (
<S.TabContainer isSelected={selectedIndex === index} onClick={() => handleSelectedIndex(index)}>
<S.TabContainer
$isSelected={selectedIndex === index}
onClick={() => handleSelectedIndex(index)}
>
{children}
</S.TabContainer>
);
Expand Down

0 comments on commit 135243d

Please sign in to comment.