Skip to content

Commit

Permalink
fix: adjust controls visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Aug 8, 2020
1 parent ba9c936 commit 74e6863
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
20 changes: 9 additions & 11 deletions ui/blocks/src/PropsTable/BasePropsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,16 @@ export const BasePropsTable: FC<BasePropsTableProps> = ({
rows.unshift.apply(rows, controlsRows);
}
const groupProps: GroupingProps = {};
if (!flat) {
if (parents.size > 1) {
const firstRowWithParent = rows.find(row => row?.prop.parentName);
if (firstRowWithParent) {
groupProps.expanded = {
[`prop.parentName:${firstRowWithParent.prop.parentName}`]: true,
};
}
groupProps.groupBy = ['prop.parentName'];
} else {
groupProps.hiddenColumns = ['prop.parentName'];
if (parents.size > 1 && !flat) {
const firstRowWithParent = rows.find(row => row?.prop.parentName);
if (firstRowWithParent) {
groupProps.expanded = {
[`prop.parentName:${firstRowWithParent.prop.parentName}`]: true,
};
}
groupProps.groupBy = ['prop.parentName'];
} else {
groupProps.hiddenColumns = ['prop.parentName'];
}
const columns = [
{
Expand Down
2 changes: 1 addition & 1 deletion ui/pages/src/ClassicPage/ClassicPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const ClassicPage: FC = () => {
<PropsTable
of="."
title={mixedControls ? 'Controls' : 'Properties'}
flat={propsCount <= threshold || mixedControls}
flat={propsCount <= threshold && !mixedControls}
visibility={splitControls ? 'info' : 'all'}
/>
<ComponentDeps id="." title="External dependencies" />
Expand Down

0 comments on commit 74e6863

Please sign in to comment.