Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: zIndex 수정 #102

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions co-kkiri/src/components/commons/Gnb/Gnb.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@ import DESIGN_TOKEN from "@/styles/tokens";
const { color, typography, mediaQueries, zIndex } = DESIGN_TOKEN;

export const Container = styled.div`
position: sticky;
top: 0;
${zIndex.sticky};
`;

export const Box = styled.div`
background-color: ${color.white};
width: 100%;
display: flex;
justify-content: space-between;
position: sticky;
top: 0;
${zIndex.default};

${mediaQueries.desktop} {
padding: 2.2rem 4rem;
Expand All @@ -23,13 +26,13 @@ export const Container = styled.div`
}
`;

export const LeftGroupBox = styled.div`
export const LeftGroupWrapper = styled.div`
display: flex;
gap: 2rem;
align-items: center;
`;

export const RightGroupBox = styled.div`
export const RightGroupWrapper = styled.div`
display: flex;
gap: 3rem;
align-items: center;
Expand Down
16 changes: 8 additions & 8 deletions co-kkiri/src/components/commons/Gnb/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ export default function Gnb({ user, onSideBarClick }: GnbProps) {
};

return (
<div ref={ref}>
<S.Container>
<S.LeftGroupBox>
<S.Container ref={ref}>
<S.Box>
<S.LeftGroupWrapper>
<button onClick={onSideBarClick}>
<img src={ICONS.category.src} alt={ICONS.category.alt} />
</button>
<Link to={HOME_PATH}>
<S.Logo src={IMAGES.logo.src} alt={IMAGES.logo.alt} />
</Link>
</S.LeftGroupBox>
<S.RightGroupBox>
</S.LeftGroupWrapper>
<S.RightGroupWrapper>
<Link to={POST_PATH}>
<S.PostButton>스터디 모집하기</S.PostButton>
</Link>
Expand All @@ -51,10 +51,10 @@ export default function Gnb({ user, onSideBarClick }: GnbProps) {
) : (
<S.SignButton onClick={handleAuthModalOpen}>로그인/회원가입</S.SignButton>
)}
</S.RightGroupBox>
</S.Container>
</S.RightGroupWrapper>
</S.Box>
{isAuthModalOpen && <AuthModal onClick={handleAuthModalOpen} onClose={handleAuthModalOpen} />}
<UserPopover isOpen={isOpen} handleSelectOption={handlePopoverOpen} />
</div>
</S.Container>
);
}
7 changes: 3 additions & 4 deletions co-kkiri/src/components/commons/UserPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@ export default function UserPopover({ isOpen, handleSelectOption }: UserPopoverP
<Container $isOpen={isOpen}>
<Box>
{popover.map((options) => (
<Link to={options.path}>
<Link to={options.path} key={options.option}>
<Option
onClick={() => {
handleSelectOption(options.option);
}}
key={options.option}>
}}>
{options.option}
</Option>
</Link>
Expand All @@ -36,7 +35,7 @@ const Container = styled.div<{ $isOpen: boolean }>`
position: absolute;
opacity: ${({ $isOpen }) => ($isOpen ? 1 : 0)};
transition: opacity 0.2s ease-in-out;
${zIndex.dropdown}
${zIndex.popover}

${mediaQueries.desktop} {
right: 4rem;
Expand Down
4 changes: 2 additions & 2 deletions co-kkiri/src/components/modals/ModalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default function ModalLayout({
);
}

const { color, overlayBackDropColor, mediaQueries } = DESIGN_TOKEN;
const { color, overlayBackDropColor, mediaQueries, zIndex } = DESIGN_TOKEN;

interface ModalBoxProps {
$mobileWidth?: number;
Expand All @@ -78,7 +78,7 @@ const Container = styled.div<{ $isSidebar?: boolean }>`
width: 100%;
height: 100vh;
background-color: ${overlayBackDropColor};
z-index: 2;
${zIndex.modal}
`;

const ModalBox = styled.div<ModalBoxProps>`
Expand Down
1 change: 1 addition & 0 deletions co-kkiri/src/styles/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const DESIGN_TOKEN = {
popover: "z-index: 60",
default: "z-index: 1",
toast: "z-index: 120",
modal: "z-index: 100",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굿입니다

},
boxShadow: {
content: "0px 4px 20px rgba(0, 0, 0, 0.08)",
Expand Down