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

[fix] collapsible layer config group ui improvements #2268

Merged
merged 2 commits into from
Jun 20, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/components/src/side-panel/layer-panel/layer-config-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,21 @@ export const StyledLayerConfigGroup = styled.div`
}
`;

interface StyledConfigGroupHeaderProps {
collapsible?: boolean;
}

export const StyledConfigGroupHeader = styled.div.attrs({
className: 'layer-config-group__header'
})`
})<StyledConfigGroupHeaderProps>`
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 12px;
cursor: default;

:hover {
cursor: pointer;
${props => props.collapsible && 'cursor: pointer;'}
.layer-config-group__label {
color: ${props => props.theme.textColorHl};
}
Expand Down Expand Up @@ -175,12 +180,12 @@ function LayerConfigGroupFactory(
}) => {
const [collapsed, toggleCollapsed] = useState(!expanded);
const onToggleCollapsed = useCallback(() => {
toggleCollapsed(!collapsed);
}, [collapsed, toggleCollapsed]);
collapsible && toggleCollapsed(!collapsed);
}, [collapsed, toggleCollapsed, collapsible]);

return (
<StyledLayerConfigGroup className={classnames('layer-config-group', {collapsed, disabled})}>
<StyledConfigGroupHeader onClick={onToggleCollapsed}>
<StyledConfigGroupHeader onClick={onToggleCollapsed} collapsible={collapsible}>
<LayerConfigGroupLabel label={label} description={description} collapsed={collapsed} />
<StyledLayerConfigGroupAction className="layer-config-group__action">
{property ? (
Expand Down
2 changes: 1 addition & 1 deletion test/node/utils/dom-to-image.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2021 Uber Technologies, Inc.
// Copyright (c) 2023 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down