Skip to content

Commit

Permalink
fix(ProjectListItemCollapsable): fix border error
Browse files Browse the repository at this point in the history
  • Loading branch information
asabotovich committed Jun 28, 2023
1 parent 321e5b7 commit 9720c34
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
31 changes: 14 additions & 17 deletions src/components/CollapsableItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const StyledHeaderContent = styled.div<{ highlighted?: boolean }>`
`}
`;

const StyledCollapsableContainer = styled.div<{ collapsed: boolean; deep: number; showLine: boolean }>`
const StyledCollapsableContainer = styled.div<{ collapsed: boolean; deep: number }>`
position: relative;
border-radius: ${radiusM};
Expand Down Expand Up @@ -156,19 +156,16 @@ export const CollapsableItem: FC<{
content: ReactNode;
deep?: number;
collapsed: boolean;
showLine?: boolean;
}> = ({ onClick, children, header, collapsed, deep = 0, showLine = true, content }) => {
return (
<StyledCollapsableContainer collapsed={collapsed} deep={deep} showLine={showLine}>
<StyledCollapsableHeader onClick={onClick}>
<StyledParentDot />
<StyledDot />
<StyledHeaderContent highlighted={!!onClick && collapsed}>{header}</StyledHeaderContent>
</StyledCollapsableHeader>
{nullable(children, (ch) => (
<StyledCollapsableItem>{ch}</StyledCollapsableItem>
))}
{!collapsed ? content : null}
</StyledCollapsableContainer>
);
};
}> = ({ onClick, children, header, collapsed, deep = 0, content }) => (
<StyledCollapsableContainer collapsed={collapsed} deep={deep}>
<StyledCollapsableHeader onClick={onClick}>
<StyledParentDot />
<StyledDot />
<StyledHeaderContent highlighted={!!onClick && collapsed}>{header}</StyledHeaderContent>
</StyledCollapsableHeader>
{nullable(children, (ch) => (
<StyledCollapsableItem>{ch}</StyledCollapsableItem>
))}
{!collapsed ? content : null}
</StyledCollapsableContainer>
);
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export const ProjectListItemCollapsable: React.FC<ProjectListItemCollapsableProp
loading = false,
deep = 0,
}) => {
const contentHidden = collapsed || loading;

const offset = collapseOffset * (contentHidden ? deep - 1 : deep);
const childs = useMemo(() => project.children.map(({ id }) => id), [project]);

const onClickEnabled = childs.length;
const contentHidden = !childs.length || collapsed || loading;

const offset = collapseOffset * (contentHidden ? deep - 1 : deep);

const onGoalsButtonClick = useCallback(
(e: MouseEvent) => {
Expand Down

0 comments on commit 9720c34

Please sign in to comment.