From 6ca9c04105529690f66f7a370b112d436db1ac71 Mon Sep 17 00:00:00 2001 From: Christian Nolte Date: Fri, 22 Dec 2017 22:30:05 +0100 Subject: [PATCH] Add collapse all/expand all to Listcontrol (#912) --- src/components/EditorWidgets/List/List.css | 11 ++- .../EditorWidgets/List/ListControl.js | 89 ++++++++++--------- .../EditorWidgets/Object/ObjectControl.js | 2 +- src/components/UI/Icon/icons.js | 5 +- src/components/UI/Icon/images/_index.js | 6 +- .../UI/Icon/images/chevron-double.svg | 8 ++ .../UI/Icon/images/{caret.svg => chevron.svg} | 0 .../UI/ListItemTopBar/ListItemTopBar.js | 2 +- 8 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 src/components/UI/Icon/images/chevron-double.svg rename src/components/UI/Icon/images/{caret.svg => chevron.svg} (100%) diff --git a/src/components/EditorWidgets/List/List.css b/src/components/EditorWidgets/List/List.css index 441299cc5f70..6e5cbdd86365 100644 --- a/src/components/EditorWidgets/List/List.css +++ b/src/components/EditorWidgets/List/List.css @@ -38,11 +38,16 @@ align-items: center; font-size: 14px; font-weight: 500; - cursor: pointer; line-height: 1; +} - & .nc-icon { - padding-right: 8px; +.nc-listControl-listCollapseToggleButton{ + padding: 4px; + background-color: transparent; + color: inherit; + + &:last-of-type { + margin-right: 4px; } } diff --git a/src/components/EditorWidgets/List/ListControl.js b/src/components/EditorWidgets/List/ListControl.js index 1399697b4a79..e1b39f3f7c46 100644 --- a/src/components/EditorWidgets/List/ListControl.js +++ b/src/components/EditorWidgets/List/ListControl.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; -import { List, Map, fromJS } from 'immutable'; +import { List, Map } from 'immutable'; import { partial } from 'lodash'; import c from 'classnames'; import { SortableContainer, SortableElement, SortableHandle } from 'react-sortable-hoc'; @@ -23,10 +23,12 @@ function valueToString(value) { const SortableListItem = SortableElement(ListItem); -const TopBar = ({ onAdd, listLabel, collapsed, onCollapseToggle, itemsCount }) => ( +const TopBar = ({ onAdd, listLabel, onCollapseAllToggle, allItemsCollapsed, itemsCount }) => (
-
- +
+ {itemsCount} {listLabel}
: null }