From 746d7e0ca5cfe0126c8b00e8cfb400bd6ba38001 Mon Sep 17 00:00:00 2001 From: Virginie Ky Date: Mon, 2 Sep 2019 17:25:30 +0200 Subject: [PATCH 1/7] some UI fixes --- .../api/address/models/Address.settings.json | 5 ++ .../models/Restaurant.settings.json | 21 ++++-- .../lib/src/components/TrashButton/index.js | 1 + .../CustomTable/styledComponents.js | 6 +- .../src/components/GroupBanner/components.js | 68 +++++++++++-------- .../src/components/SelectMany/components.js | 15 ++-- .../components/SelectWrapper/components.js | 5 -- .../ViewContainer/StyledViewContainer.js | 7 ++ 8 files changed, 76 insertions(+), 52 deletions(-) diff --git a/examples/getstarted/api/address/models/Address.settings.json b/examples/getstarted/api/address/models/Address.settings.json index 51fe9b4d17..20d900fa46 100755 --- a/examples/getstarted/api/address/models/Address.settings.json +++ b/examples/getstarted/api/address/models/Address.settings.json @@ -28,6 +28,11 @@ }, "country": { "model": "country" + }, + "abcnhfdnhbgfderftghnnhgtfrertghnhgres": { + "collection": "abc", + "dominant": true, + "via": "addresses" } } } \ No newline at end of file diff --git a/examples/getstarted/api/restaurant/models/Restaurant.settings.json b/examples/getstarted/api/restaurant/models/Restaurant.settings.json index 2ddaf2fa19..e0b1ac182f 100755 --- a/examples/getstarted/api/restaurant/models/Restaurant.settings.json +++ b/examples/getstarted/api/restaurant/models/Restaurant.settings.json @@ -7,7 +7,10 @@ }, "options": { "increments": true, - "timestamps": ["created_at", "updated_at"], + "timestamps": [ + "created_at", + "updated_at" + ], "comment": "" }, "attributes": { @@ -29,11 +32,14 @@ "categories": { "collection": "category" }, - "address": { - "model": "address" - }, "price_range": { - "enum": ["very_cheap", "cheap", "average", "expensive", "very_expensive"], + "enum": [ + "very_cheap", + "cheap", + "average", + "expensive", + "very_expensive" + ], "type": "enumeration" }, "description": { @@ -57,6 +63,9 @@ "required": true, "repeatable": true, "type": "group" + }, + "address": { + "model": "address" } } -} +} \ No newline at end of file diff --git a/packages/strapi-helper-plugin/lib/src/components/TrashButton/index.js b/packages/strapi-helper-plugin/lib/src/components/TrashButton/index.js index f01f6243df..feb96a520a 100644 --- a/packages/strapi-helper-plugin/lib/src/components/TrashButton/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/TrashButton/index.js @@ -43,4 +43,5 @@ const TrashButton = styled.div` } } `; + export default TrashButton; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/styledComponents.js b/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/styledComponents.js index 7fee0ce634..3d9f0f83bb 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/styledComponents.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/CustomTable/styledComponents.js @@ -106,11 +106,7 @@ const Icon = styled.i` }} `; -const Truncate = styled.div` - // display: table; - // table-layout: fixed; - // width: 100%; -`; +const Truncate = styled.div``; const Truncated = styled.p` overflow-x: hidden; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/GroupBanner/components.js b/packages/strapi-plugin-content-manager/admin/src/components/GroupBanner/components.js index 02664b84b7..fc66cf9a32 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/GroupBanner/components.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/GroupBanner/components.js @@ -73,36 +73,48 @@ const Wrapper = styled(Flex)` cursor: pointer; background-color: ${({ hasErrors, isOpen }) => { - if (hasErrors && isOpen) { - return '#FFE9E0'; - } else if (isOpen) { - return '#E6F0FB'; - } else { - return '#ffffff'; - } - }} - ${({ hasErrors, isOpen }) => { - if (hasErrors) { - return css` - color: #f64d0a; - font-weight: 600; - `; - } - - if (isOpen) { - return css` - color: #007eff; - font-weight: 600; - `; - } - }} - button, - i, img { - &:active, - &:focus { - outline: 0; + if (hasErrors && isOpen) { + return '#FFE9E0'; + } else if (isOpen) { + return '#E6F0FB'; + } else { + return '#ffffff'; } + }}; + + + ${({ hasErrors, isOpen }) => { + if (hasErrors) { + return css` + color: #f64d0a; + font-weight: 600; + `; + } + if (isOpen) { + return css` + color: #007eff; + font-weight: 600; + `; + } + }} + + button, + i, img { + &:active, + &:focus { + outline: 0; } + + ${({ isOpen }) => { + if (isOpen) { + return css` + &.trash-icon i { + color: #007eff; + } + `; + } + }} + webkit-font-smoothing: antialiased; `; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/components.js b/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/components.js index fe91d9379b..1cc182d63d 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/components.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SelectMany/components.js @@ -5,7 +5,7 @@ const ListWrapper = styled.div` max-height: 116px; > ul { - margin: 4px -20px 0; + margin: 0 -20px 0; padding: 0 20px !important; list-style: none !important; overflow: auto; @@ -37,14 +37,13 @@ const Li = styled.li` flex-wrap: nowrap; align-content: center; justify-content: space-between; - height: 27px; - background-color: transparent !important; - margin-bottom: 9px; - + height: 18px; + margin-top: 9px; + &:last-of-type { + margin-bottom: 0px; + } &:active { .dragHandle { - // cursor: pointer; - > span { background: #aed4fb; } @@ -132,7 +131,7 @@ const Li = styled.li` display: inline-block; height: 100%; padding-right: 0px; - line-height: 27px; + line-height: 18px; text-align: right; white-space: nowrap; overflow: hidden; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/components.js b/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/components.js index a381f082ad..386bd29767 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/components.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/components.js @@ -94,11 +94,6 @@ const Wrapper = styled.div` } } } - & + div { - ul { - margin-bottom: -4px; - } - } } `; diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ViewContainer/StyledViewContainer.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ViewContainer/StyledViewContainer.js index e214c414ba..8dfd01e728 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ViewContainer/StyledViewContainer.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ViewContainer/StyledViewContainer.js @@ -38,6 +38,13 @@ const StyledViewContainer = styled.div` padding-top: 3.4rem; display: flex; justify-content: flex-end; + > div { + height: 30px; + line-height: 30px; + > div { + padding: 0 15px; + } + } } } `; From a3e044da87ecaec1b4633a44ea9ff34b670aaa1b Mon Sep 17 00:00:00 2001 From: Virginie Ky Date: Tue, 3 Sep 2019 12:29:12 +0200 Subject: [PATCH 2/7] leftmenu responsive ui --- .../src/components/LeftMenuLink/styles.scss | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/packages/strapi-admin/admin/src/components/LeftMenuLink/styles.scss b/packages/strapi-admin/admin/src/components/LeftMenuLink/styles.scss index 02551c20af..705d3dc8e6 100644 --- a/packages/strapi-admin/admin/src/components/LeftMenuLink/styles.scss +++ b/packages/strapi-admin/admin/src/components/LeftMenuLink/styles.scss @@ -1,5 +1,5 @@ // Import -@import "../../styles/variables/variables"; +@import '../../styles/variables/variables'; .item { position: relative; @@ -12,13 +12,14 @@ .plugin { cursor: pointer; position: absolute; - top: 10px; left: calc(100% - 4px); + top: 10px; + left: calc(100% - 4px); display: inline-block; width: auto; height: 20px; transition: right 1s ease-in-out; - span{ + span { display: inline-block; overflow: hidden; width: auto; @@ -29,10 +30,10 @@ line-height: 20px; background: #0097f7; border-radius: 3px; - transition: transform .3s ease-in-out; + transition: transform 0.3s ease-in-out; white-space: pre; - &:hover{ + &:hover { transform: translateX(calc(-100% + 9px)); } } @@ -40,7 +41,8 @@ } .link { - padding-top: .9rem; + position: relative; + padding-top: 0.8rem; padding-bottom: 0.2rem; padding-left: 1.6rem; min-height: 3.6rem; @@ -66,6 +68,15 @@ &:visited { color: $left-menu-link-color; } + span { + display: inline-block; + padding-right: 1rem; + padding-left: 2.6rem; + width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } .linkActive { @@ -74,7 +85,9 @@ } .linkIcon { - position: relative; + position: absolute; + top: calc(50% - 0.9rem + 0.6rem); + left: 1.6rem; margin-right: 1.2rem; font-size: 1.2rem; width: 1.4rem; @@ -86,4 +99,6 @@ .linkLabel { display: inline-block; padding-right: 1rem; + padding-left: 2.6rem; + width: 100%; } From 5453a311fcbd25ff6fd0711484032c946b4e1a0e Mon Sep 17 00:00:00 2001 From: Virginie Ky Date: Tue, 3 Sep 2019 21:15:32 +0200 Subject: [PATCH 3/7] some UI fixes --- .../PluginHeader/StyledPluginHeader.js | 16 +++++++ .../lib/src/components/PluginHeader/index.js | 42 ++++++++-------- .../src/components/PluginHeader/styles.scss | 3 -- .../StyledPluginHeaderActions.js | 26 ++++++++++ .../components/PluginHeaderActions/index.js | 22 ++------- .../PluginHeaderActions/styles.scss | 6 --- .../StyledPluginHeaderTitle.js | 48 +++++++++++++++++++ .../src/components/PluginHeaderTitle/index.js | 32 ++++++------- .../components/PluginHeaderTitle/styles.scss | 23 --------- .../components/SelectWrapper/components.js | 4 ++ .../admin/src/containers/EditView/index.js | 4 +- .../admin/src/components/BackHeader/index.js | 0 .../containers/AttributesPickerModal/index.js | 6 ++- .../admin/src/containers/ModelPage/index.js | 18 +++++-- .../ViewContainer/StyledViewContainer.js | 7 +-- 15 files changed, 156 insertions(+), 101 deletions(-) create mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeader/StyledPluginHeader.js delete mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeader/styles.scss create mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/StyledPluginHeaderActions.js delete mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/styles.scss create mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/StyledPluginHeaderTitle.js delete mode 100644 packages/strapi-helper-plugin/lib/src/components/PluginHeaderTitle/styles.scss create mode 100644 packages/strapi-plugin-content-type-builder/admin/src/components/BackHeader/index.js diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/StyledPluginHeader.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/StyledPluginHeader.js new file mode 100644 index 0000000000..88a5cf4926 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/StyledPluginHeader.js @@ -0,0 +1,16 @@ +/** + * + * StyledPluginHeader + * + */ + +import styled from 'styled-components'; + +const StyledPluginHeader = styled.div` + margin-bottom: 30px; + .justify-content-end { + display: flex; + } +`; + +export default StyledPluginHeader; diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js index f696b18d63..03e650ec17 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/index.js @@ -11,7 +11,7 @@ import cn from 'classnames'; import PluginHeaderTitle from '../PluginHeaderTitle'; import PluginHeaderActions from '../PluginHeaderActions'; -import styles from './styles.scss'; +import StyledPluginHeader from './StyledPluginHeader'; function PluginHeader({ actions, @@ -25,27 +25,27 @@ function PluginHeader({ withDescriptionAnim, }) { return ( -
-
- + +
+
+ +
+
+ + +
-
- -
-
- -
-
+ ); } diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/styles.scss b/packages/strapi-helper-plugin/lib/src/components/PluginHeader/styles.scss deleted file mode 100644 index a1259bd571..0000000000 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeader/styles.scss +++ /dev/null @@ -1,3 +0,0 @@ -.pluginHeader { - margin-bottom: 30px; -} diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/StyledPluginHeaderActions.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/StyledPluginHeaderActions.js new file mode 100644 index 0000000000..f91d8f0756 --- /dev/null +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/StyledPluginHeaderActions.js @@ -0,0 +1,26 @@ +/** + * + * StyledPluginHeaderActions + * + */ + +import styled from 'styled-components'; + +const StyledPluginHeaderActions = styled.div` + display: flex; + justify-content: flex-end; + width: fit-content; + max-width: 100%; + padding-top: 0.9rem; + button { + margin-right: 0; + margin-left: 1.8rem; + max-width: 100%; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + text-align: center; + } +`; + +export default StyledPluginHeaderActions; diff --git a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js index 544638b577..e494c65509 100644 --- a/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js +++ b/packages/strapi-helper-plugin/lib/src/components/PluginHeaderActions/index.js @@ -10,26 +10,20 @@ import { isArray, isFunction } from 'lodash'; import Button from '../Button'; -import styles from './styles.scss'; +import StyledPluginHeaderActions from './StyledPluginHeaderActions'; function PluginHeaderActions({ actions, overrideRendering }) { let content = ''; if (isArray(actions)) { - content = actions.map(action => ( -