From 9b6785a69745e487162cd2a58352b0ab9f19deeb Mon Sep 17 00:00:00 2001 From: ronronscelestes Date: Tue, 5 Jul 2022 11:32:32 +0200 Subject: [PATCH 1/2] fixed select tree disabled state + style --- .../ReactSelect/utils/getSelectStyles.js | 16 ++++++++++++++-- .../src/components/EditAssetDialog/index.js | 2 +- .../EditFolderDialog/EditFolderDialog.js | 1 + 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js b/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js index 1de09ee4e3..97077646a2 100644 --- a/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js +++ b/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js @@ -15,6 +15,8 @@ const getSelectStyles = (theme, error) => { border = `1px solid ${theme.colors.primary600} !important`; } else if (error) { border = `1px solid ${theme.colors.danger600} !important`; + } else if (state.isDisabled) { + border = `1px solid ${theme.colors.neutral200} !important`; } else { border = `1px solid ${theme.colors.neutral200} !important`; } @@ -24,7 +26,7 @@ const getSelectStyles = (theme, error) => { } if (state.isDisabled) { - backgroundColor = '#fafafb !important'; + backgroundColor = `${theme.colors.neutral150} !important`; } return { @@ -90,7 +92,17 @@ const getSelectStyles = (theme, error) => { }; }, placeholder: base => ({ ...base, marginLeft: 0 }), - singleValue: base => ({ ...base, marginLeft: 0, color: theme.colors.neutral800 }), + singleValue: (base, state) => { + let color; + + if (state.isDisabled) { + color = theme.colors.neutral600; + } else { + color = theme.colors.neutral800; + } + + return { ...base, marginLeft: 0, color }; + }, valueContainer: base => ({ ...base, padding: 0, diff --git a/packages/core/upload/admin/src/components/EditAssetDialog/index.js b/packages/core/upload/admin/src/components/EditAssetDialog/index.js index c499af0bec..636ad44584 100644 --- a/packages/core/upload/admin/src/components/EditAssetDialog/index.js +++ b/packages/core/upload/admin/src/components/EditAssetDialog/index.js @@ -270,7 +270,7 @@ export const EditAssetDialog = ({ }} menuPortalTarget={document.querySelector('body')} inputId="asset-folder" - disabled={formDisabled} + isDisabled={formDisabled} error={errors?.parent} ariaErrorMessage="folder-parent-error" /> diff --git a/packages/core/upload/admin/src/components/EditFolderDialog/EditFolderDialog.js b/packages/core/upload/admin/src/components/EditFolderDialog/EditFolderDialog.js index 9f72819c06..045bebb487 100644 --- a/packages/core/upload/admin/src/components/EditFolderDialog/EditFolderDialog.js +++ b/packages/core/upload/admin/src/components/EditFolderDialog/EditFolderDialog.js @@ -201,6 +201,7 @@ export const EditFolderDialog = ({ onClose, folder, parentFolderId }) => { onChange={value => { setFieldValue('parent', value); }} + isDisabled={formDisabled} defaultValue={values.parent} name="parent" menuPortalTarget={document.querySelector('body')} From f383fbb6a7ed21c5014638c81ff516830ba5222e Mon Sep 17 00:00:00 2001 From: ronronscelestes Date: Tue, 5 Jul 2022 16:14:51 +0200 Subject: [PATCH 2/2] feedback fixes --- .../ReactSelect/utils/getSelectStyles.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js b/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js index 97077646a2..a1978e20e1 100644 --- a/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js +++ b/packages/core/helper-plugin/lib/src/components/ReactSelect/utils/getSelectStyles.js @@ -7,22 +7,13 @@ const getSelectStyles = (theme, error) => { lineHeight: 'normal', }), control: (base, state) => { - let border; - let borderBottom; + let border = `1px solid ${theme.colors.neutral200} !important`; let backgroundColor; if (state.isFocused) { - border = `1px solid ${theme.colors.primary600} !important`; + border = `1px solid ${theme.colors.primary200} !important`; } else if (error) { border = `1px solid ${theme.colors.danger600} !important`; - } else if (state.isDisabled) { - border = `1px solid ${theme.colors.neutral200} !important`; - } else { - border = `1px solid ${theme.colors.neutral200} !important`; - } - - if (state.menuIsOpen === true) { - borderBottom = `1px solid ${theme.colors.primary600} !important`; } if (state.isDisabled) { @@ -37,7 +28,6 @@ const getSelectStyles = (theme, error) => { outline: 0, boxShadow: 0, borderRadius: '2px !important', - borderBottom, backgroundColor, borderTopLeftRadius: '4px !important', borderTopRightRadius: '4px !important', @@ -93,12 +83,10 @@ const getSelectStyles = (theme, error) => { }, placeholder: base => ({ ...base, marginLeft: 0 }), singleValue: (base, state) => { - let color; + let color = theme.colors.neutral800; if (state.isDisabled) { color = theme.colors.neutral600; - } else { - color = theme.colors.neutral800; } return { ...base, marginLeft: 0, color };