diff --git a/packages/core/admin/admin/src/components/Roles/ConditionsButton/index.js b/packages/core/admin/admin/src/components/Roles/ConditionsButton/index.js index a90459a83f..a445371892 100644 --- a/packages/core/admin/admin/src/components/Roles/ConditionsButton/index.js +++ b/packages/core/admin/admin/src/components/Roles/ConditionsButton/index.js @@ -7,8 +7,6 @@ import styled from 'styled-components'; const Wrapper = styled.div` position: relative; - margin-left: auto; - padding-right: ${({ theme }) => theme.spaces[6]}; ${({ hasConditions, disabled, theme }) => hasConditions && @@ -26,12 +24,12 @@ const Wrapper = styled.div` `} `; -const ConditionsButton = ({ onClick, className, hasConditions }) => { +const ConditionsButton = ({ onClick, className, hasConditions, variant }) => { const { formatMessage } = useIntl(); return ( - } onClick={onClick}> + } onClick={onClick}> {formatMessage({ id: 'app.components.LeftMenuLinkContainer.settings' })} @@ -41,11 +39,13 @@ const ConditionsButton = ({ onClick, className, hasConditions }) => { ConditionsButton.defaultProps = { className: null, hasConditions: false, + variant: 'secondary', }; ConditionsButton.propTypes = { onClick: PropTypes.func.isRequired, className: PropTypes.string, hasConditions: PropTypes.bool, + variant: PropTypes.string, }; // This is a styled component advanced usage : diff --git a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js index b62f694c3c..a31f0b0605 100644 --- a/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js +++ b/packages/core/admin/admin/src/components/Roles/ContentTypeCollapse/Collapse/index.js @@ -137,7 +137,7 @@ const Collapse = ({ {isActive ? : } - + {checkboxesActions.map( ({ actionId, @@ -196,10 +196,12 @@ const Collapse = ({ } )} - + + + {modalState.isMounted && ( theme.main.colors.white}; - border-bottom-left-radius: ${({ theme }) => theme.main.sizes.borderRadius}; - border-bottom-right-radius: ${({ theme }) => theme.main.sizes.borderRadius}; - padding: 1.8rem 0; -`; - -export default ListWrapper; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js deleted file mode 100644 index 4ed1014fd8..0000000000 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/Wrapper.js +++ /dev/null @@ -1,28 +0,0 @@ -import styled from 'styled-components'; -import { Text } from '@buffetjs/core'; - -const activeStyle = theme => ` - background-color: ${theme.main.colors.lightestBlue}; - border: 1px solid ${theme.main.colors.darkBlue}; - ${Text} { - color: ${theme.main.colors.mediumBlue}; - } - svg { - color: ${theme.main.colors.mediumBlue}; - } -`; - -const RowStyle = styled.div` - height: 5.4rem; - padding: 1rem 3rem; - border: 1px solid transparent; - background-color: ${({ theme, isWhite }) => theme.main.colors[isWhite ? 'white' : 'lightGrey']}; - cursor: pointer; - &:hover { - background-color: ${({ theme }) => theme.main.colors.lightestBlue}; - ${({ theme }) => activeStyle(theme)}; - } - ${({ isActive, theme }) => isActive && activeStyle(theme)}; -`; - -export default RowStyle; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/index.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/index.js index abbfd03adb..d9dafcbfe7 100644 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/index.js +++ b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/Row/index.js @@ -1,11 +1,9 @@ -import React, { useMemo } from 'react'; -import { Flex, Text } from '@buffetjs/core'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { PermissionsWrapper, RowContainer } from '@strapi/helper-plugin'; +import { Accordion, AccordionContent, AccordionToggle, Box } from '@strapi/parts'; +import upperFirst from 'lodash/upperFirst'; import PropTypes from 'prop-types'; +import React, { useMemo } from 'react'; import { useIntl } from 'react-intl'; import SubCategory from '../SubCategory'; -import RowStyle from './Wrapper'; const PermissionRow = ({ childrenForm, @@ -30,26 +28,18 @@ const PermissionRow = ({ }, [name]); return ( - - - - - - {categoryName} - - - {formatMessage({ id: 'Settings.permissions.category' }, { category: categoryName })} - {kind === 'plugins' ? 'plugin' : kind} - - - - - - - + + - {isOpen && ( - + + {childrenForm.map(({ actions, subCategoryName, subCategoryId }) => ( ))} - - )} - + + + ); }; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/CheckboxWrapper.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/CheckboxWrapper.js deleted file mode 100644 index 5c6429d212..0000000000 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/CheckboxWrapper.js +++ /dev/null @@ -1,22 +0,0 @@ -/* eslint-disable indent */ -import styled from 'styled-components'; - -const CheckboxWrapper = styled.div` - min-width: 33%; - padding: 0.9rem; - height: 3.6rem; - position: relative; - ${({ hasConditions, disabled, theme }) => - hasConditions && - ` - &:before { - content: '•'; - position: absolute; - top: 2px; - left: 0px; - color: ${disabled ? theme.main.colors.grey : theme.main.colors.mediumBlue}; - } - `} -`; - -export default CheckboxWrapper; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/ConditionsButtonWrapper.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/ConditionsButtonWrapper.js deleted file mode 100644 index aea1db164d..0000000000 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/ConditionsButtonWrapper.js +++ /dev/null @@ -1,13 +0,0 @@ -/* eslint-disable indent */ -import styled from 'styled-components'; - -const ConditionsButtonWrapper = styled.div` - padding: 0.9rem; - ${({ hasConditions }) => - hasConditions && - ` - padding-left: 22px; - `} -`; - -export default ConditionsButtonWrapper; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/Wrapper.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/Wrapper.js deleted file mode 100644 index aebf74cd33..0000000000 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/Wrapper.js +++ /dev/null @@ -1,26 +0,0 @@ -/* eslint-disable indent */ -import styled from 'styled-components'; - -const Wrapper = styled.div` - padding-bottom: 2.6rem; - input[type='checkbox'] { - &:after { - color: ${({ theme }) => theme.main.colors.mediumBlue}; - } - } - ${({ disabled, theme }) => - disabled && - ` - label { - cursor: default !important; - color: ${theme.main.colors.grey}; - } - input[type='checkbox'] { - &:after { - color: ${theme.main.colors.grey}; - } - } - `} -`; - -export default Wrapper; diff --git a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js index 7882f9f905..6691930cd0 100644 --- a/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js +++ b/packages/core/admin/admin/src/components/Roles/PluginsAndSettings/SubCategory/index.js @@ -1,25 +1,39 @@ import React, { useMemo, useState } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; -import { Flex, Padded, Text, Checkbox } from '@buffetjs/core'; +import { Row, Box, TableLabel, Checkbox, Grid, GridItem } from '@strapi/parts'; + import { useIntl } from 'react-intl'; -import { BaselineAlignment } from '@strapi/helper-plugin'; import { get } from 'lodash'; import IS_DISABLED from 'ee_else_ce/components/Roles/PluginsAndSettings/SubCategory/utils/constants'; import { usePermissionsDataManager } from '../../../../hooks'; import { getCheckboxState, removeConditionKeyFromData } from '../../utils'; import ConditionsButton from '../../ConditionsButton'; import ConditionsModal from '../../ConditionsModal'; -import CheckboxWrapper from './CheckboxWrapper'; -import ConditionsButtonWrapper from './ConditionsButtonWrapper'; -import Wrapper from './Wrapper'; import { formatActions, getConditionsButtonState } from './utils'; const Border = styled.div` flex: 1; align-self: center; - border-top: 1px solid #f6f6f6; - padding: 0px 10px; + border-top: 1px solid ${({ theme }) => theme.colors.neutral150}; +`; + +const CheckboxWrapper = styled.div` + position: relative; + ${({ hasConditions, disabled, theme }) => + hasConditions && + ` + &:before { + content: ''; + position: absolute; + top: -4px; + left: -8px; + width: 6px; + height: 6px; + border-radius: 20px; + background: ${disabled ? theme.colors.neutral100 : theme.colors.primary600}; + } + `} `; const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, pathToData }) => { @@ -56,61 +70,67 @@ const SubCategory = ({ categoryName, isFormDisabled, subCategoryName, actions, p return ( <> - - - - - {subCategoryName} - - + + + + {subCategoryName} + - - + + onChangeParentCheckbox({ + target: { + name: pathToData.join('..'), + value, + }, + })} + indeterminate={hasSomeActionsSelected} value={hasAllActionsSelected} - /> - - - - - + > + {formatMessage({ id: 'app.utils.select-all' })} + + + + + {formattedActions.map(({ checkboxName, value, action, displayName, hasConditions }) => { return ( - - + - + hasConditions={hasConditions} + > + + onChangeSimpleCheckbox({ + target: { + name: checkboxName, + value, + }, + })} + value={value} + > + {displayName} + + + ); })} - - - - - - + + + + {modalState.isMounted && ( { @@ -12,25 +11,23 @@ const PluginsAndSettingsPermissions = ({ isFormDisabled, kind, layout }) => { }; return ( - - - {layout.map(({ category, categoryId, childrenForm }, index) => { - return ( - - ); - })} - - + + {layout.map(({ category, categoryId, childrenForm }, index) => { + return ( + + ); + })} + ); }; diff --git a/packages/core/admin/admin/src/components/Roles/RowLabelWithCheckbox/index.js b/packages/core/admin/admin/src/components/Roles/RowLabelWithCheckbox/index.js index 32b7218977..6c56978405 100644 --- a/packages/core/admin/admin/src/components/Roles/RowLabelWithCheckbox/index.js +++ b/packages/core/admin/admin/src/components/Roles/RowLabelWithCheckbox/index.js @@ -1,7 +1,8 @@ -import React, { memo } from 'react'; +import { Box, Checkbox, Text } from '@strapi/parts'; +import upperFirst from 'lodash/upperFirst'; import PropTypes from 'prop-types'; +import React, { memo } from 'react'; import styled from 'styled-components'; -import { Checkbox, Text, Box } from '@strapi/parts'; import CollapseLabel from '../CollapseLabel'; import { firstRowWidth } from '../Permissions/utils/constants'; @@ -67,7 +68,7 @@ const RowLabelWithCheckbox = ({ role: 'button', })} > - {label.charAt(0).toUpperCase() + label.slice(1)} + {upperFirst(label)} {children}