Skip to content

Commit

Permalink
fix-fe: popOverMenu width 수정 (#406)
Browse files Browse the repository at this point in the history
Co-authored-by: Jeongwoo Park <[email protected]>
  • Loading branch information
2 people authored and seongjinme committed Aug 23, 2024
1 parent 802f932 commit 5395b98
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
4 changes: 4 additions & 0 deletions frontend/src/components/common/DropdownItem/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ const Item = styled.button<{ isHighlight: boolean; size: 'sm' | 'md' }>`
cursor: pointer;
transition: all 0.2s ease-in-out;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
&:hover {
background-color: ${({ isHighlight, theme }) =>
isHighlight ? theme.baseColors.redscale[300] : theme.baseColors.grayscale[300]};
Expand Down
30 changes: 16 additions & 14 deletions frontend/src/components/common/PopOverMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,22 @@ export default function PopOverMenu({ isOpen, setClose, size = 'sm', popOverPosi
popOverPosition={popOverPosition}
>
{isOpen && (
<S.List size={size}>
{items.map(({ name, isHighlight, id, onClick }) => (
<DropdownItem
size={size}
onClick={() => {
setClose();
onClick({ targetProcessId: id });
}}
key={id}
item={name}
isHighlight={isHighlight}
/>
))}
</S.List>
<S.ListWrapper>
<S.List size={size}>
{items.map(({ name, isHighlight, id, onClick }) => (
<DropdownItem
size={size}
onClick={() => {
setClose();
onClick({ targetProcessId: id });
}}
key={id}
item={name}
isHighlight={isHighlight}
/>
))}
</S.List>
</S.ListWrapper>
)}
</S.Container>
);
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/common/PopOverMenu/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ interface ContainerProps {
size: 'sm' | 'md';
isOpen: boolean;
popOverPosition?: string;
right?: number;
}

const Container = styled.div<ContainerProps>`
min-width: ${({ size }) => (size === 'sm' ? '90px' : '240px')};
width: ${({ size }) => (size === 'sm' ? '120px' : '240px')};
position: absolute;
inset: ${({ popOverPosition }) => popOverPosition ?? 'inherit'};
Expand All @@ -19,6 +21,10 @@ const Container = styled.div<ContainerProps>`
z-index: 1;
`;

const ListWrapper = styled.div`
padding: 0 0.8rem 0.8rem;
`;

const List = styled.div<{ size: 'sm' | 'md' }>`
width: 100%;
padding: ${({ size }) => (size === 'md' ? '16px' : '8px')};
Expand All @@ -33,6 +39,7 @@ const List = styled.div<{ size: 'sm' | 'md' }>`

const S = {
Container,
ListWrapper,
List,
};

Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/dashboard/ApplicantCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default function ApplicantCard({ name, createdAt, popOverMenuItems, onCar
}
};

const handleMouseLeave = () => {
setIsPopOverOpen(false);
};

useEffect(() => {
if (isPopOverOpen) {
document.addEventListener('mousedown', handleClickOutside);
Expand All @@ -47,7 +51,10 @@ export default function ApplicantCard({ name, createdAt, popOverMenuItems, onCar
};

return (
<S.CardContainer onClick={cardClickHandler}>
<S.CardContainer
onMouseLeave={handleMouseLeave}
onClick={cardClickHandler}
>
<S.CardDetail>
<S.CardHeader>{name}</S.CardHeader>
<S.CardDate>{`지원 일자: ${formatDate(createdAt)}`}</S.CardDate>
Expand Down

0 comments on commit 5395b98

Please sign in to comment.