From b26a4fe66b066bf1bbb932c3395796fd579156a7 Mon Sep 17 00:00:00 2001 From: soupette Date: Thu, 21 Oct 2021 15:50:17 +0200 Subject: [PATCH 1/3] Add back button to roles pages Signed-off-by: soupette --- .../pages/Roles/EditPage/index.js | 12 +- .../tests/__snapshots__/index.test.js.snap | 654 ++++++++++------- .../pages/Roles/CreatePage/index.js | 10 + .../tests/__snapshots__/index.test.js.snap | 690 ++++++++++-------- 4 files changed, 813 insertions(+), 553 deletions(-) diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js index a07e3635b7..d5009b1454 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/index.js @@ -1,3 +1,4 @@ +import React, { useRef, useState } from 'react'; import { request, useNotification, @@ -12,8 +13,9 @@ import { ContentLayout, HeaderLayout } from '@strapi/parts/Layout'; import { Main } from '@strapi/parts/Main'; import { Stack } from '@strapi/parts/Stack'; import { Formik } from 'formik'; +import { Link } from '@strapi/parts/Link'; +import BackIcon from '@strapi/icons/BackIcon'; import get from 'lodash/get'; -import React, { useRef, useState } from 'react'; import { useIntl } from 'react-intl'; import { useRouteMatch } from 'react-router-dom'; import { Permissions, RoleForm } from './components'; @@ -129,6 +131,14 @@ const EditPage = () => { id: 'Settings.roles.create.description', defaultMessage: 'Define the rights given to the role', })} + navigationAction={ + } to="/settings/roles"> + {formatMessage({ + id: 'app.components.go-back', + defaultMessage: 'Go back', + })} + + } /> diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/tests/__snapshots__/index.test.js.snap b/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/tests/__snapshots__/index.test.js.snap index ad500f3ae4..721b0dc54a 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/tests/__snapshots__/index.test.js.snap +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/Roles/EditPage/tests/__snapshots__/index.test.js.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[` renders and matches the snapshot 1`] = ` -.c41 { +.c48 { border: 0; -webkit-clip: rect(0 0 0 0); clip: rect(0 0 0 0); @@ -13,33 +13,33 @@ exports[` renders and matches the snapshot 1`] = ` width: 1px; } -.c16 { +.c23 { background: #ffffff; padding: 24px; border-radius: 4px; box-shadow: 0px 1px 4px rgba(33,33,52,0.1); } -.c10 { +.c17 { font-weight: 400; font-size: 0.875rem; line-height: 1.43; color: #32324d; } -.c22 { +.c29 { font-weight: 500; font-size: 0.75rem; line-height: 1.33; color: #32324d; } -.c11 { +.c18 { font-weight: 600; line-height: 1.14; } -.c7 { +.c14 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -53,21 +53,21 @@ exports[` renders and matches the snapshot 1`] = ` outline: none; } -.c7 svg { +.c14 svg { height: 12px; width: 12px; } -.c7 svg > g, -.c7 svg path { +.c14 svg > g, +.c14 svg path { fill: #ffffff; } -.c7[aria-disabled='true'] { +.c14[aria-disabled='true'] { pointer-events: none; } -.c7:after { +.c14:after { -webkit-transition-property: all; transition-property: all; -webkit-transition-duration: 0.2s; @@ -82,11 +82,11 @@ exports[` renders and matches the snapshot 1`] = ` border: 2px solid transparent; } -.c7:focus-visible { +.c14:focus-visible { outline: none; } -.c7:focus-visible:after { +.c14:focus-visible:after { border-radius: 8px; content: ''; position: absolute; @@ -97,7 +97,7 @@ exports[` renders and matches the snapshot 1`] = ` border: 2px solid #4945ff; } -.c8 { +.c15 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; @@ -109,7 +109,7 @@ exports[` renders and matches the snapshot 1`] = ` background: #4945ff; } -.c8 .sc-dwfUuu { +.c15 .sc-dwfUuu { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -120,49 +120,49 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c8 .c9 { +.c15 .c16 { color: #ffffff; } -.c8[aria-disabled='true'] { +.c15[aria-disabled='true'] { border: 1px solid #dcdce4; background: #eaeaef; } -.c8[aria-disabled='true'] .c9 { +.c15[aria-disabled='true'] .c16 { color: #666687; } -.c8[aria-disabled='true'] svg > g, -.c8[aria-disabled='true'] svg path { +.c15[aria-disabled='true'] svg > g, +.c15[aria-disabled='true'] svg path { fill: #666687; } -.c8[aria-disabled='true']:active { +.c15[aria-disabled='true']:active { border: 1px solid #dcdce4; background: #eaeaef; } -.c8[aria-disabled='true']:active .c9 { +.c15[aria-disabled='true']:active .c16 { color: #666687; } -.c8[aria-disabled='true']:active svg > g, -.c8[aria-disabled='true']:active svg path { +.c15[aria-disabled='true']:active svg > g, +.c15[aria-disabled='true']:active svg path { fill: #666687; } -.c8:hover { +.c15:hover { border: 1px solid #7b79ff; background: #7b79ff; } -.c8:active { +.c15:active { border: 1px solid #4945ff; background: #4945ff; } -.c21 { +.c28 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; @@ -174,7 +174,7 @@ exports[` renders and matches the snapshot 1`] = ` background: #f0f0ff; } -.c21 .sc-dwfUuu { +.c28 .sc-dwfUuu { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -185,66 +185,66 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c21 .c9 { +.c28 .c16 { color: #ffffff; } -.c21[aria-disabled='true'] { +.c28[aria-disabled='true'] { border: 1px solid #dcdce4; background: #eaeaef; } -.c21[aria-disabled='true'] .c9 { +.c28[aria-disabled='true'] .c16 { color: #666687; } -.c21[aria-disabled='true'] svg > g, -.c21[aria-disabled='true'] svg path { +.c28[aria-disabled='true'] svg > g, +.c28[aria-disabled='true'] svg path { fill: #666687; } -.c21[aria-disabled='true']:active { +.c28[aria-disabled='true']:active { border: 1px solid #dcdce4; background: #eaeaef; } -.c21[aria-disabled='true']:active .c9 { +.c28[aria-disabled='true']:active .c16 { color: #666687; } -.c21[aria-disabled='true']:active svg > g, -.c21[aria-disabled='true']:active svg path { +.c28[aria-disabled='true']:active svg > g, +.c28[aria-disabled='true']:active svg path { fill: #666687; } -.c21:hover { +.c28:hover { background-color: #ffffff; } -.c21:active { +.c28:active { background-color: #ffffff; border: 1px solid #4945ff; } -.c21:active .c9 { +.c28:active .c16 { color: #4945ff; } -.c21:active svg > g, -.c21:active svg path { +.c28:active svg > g, +.c28:active svg path { fill: #4945ff; } -.c21 .c9 { +.c28 .c16 { color: #271fe0; } -.c21 svg > g, -.c21 svg path { +.c28 svg > g, +.c28 svg path { fill: #271fe0; } -.c39 { +.c46 { border: 0; -webkit-clip: rect(0 0 0 0); clip: rect(0 0 0 0); @@ -256,12 +256,12 @@ exports[` renders and matches the snapshot 1`] = ` width: 1px; } -.c40 { +.c47 { -webkit-animation: gzYjWD 1s infinite linear; animation: gzYjWD 1s infinite linear; } -.c18 { +.c25 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -279,7 +279,7 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c37 { +.c44 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -297,7 +297,7 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c5 { +.c12 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -311,7 +311,7 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c15 { +.c22 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -321,16 +321,16 @@ exports[` renders and matches the snapshot 1`] = ` flex-direction: column; } -.c15 > * { +.c22 > * { margin-top: 0; margin-bottom: 0; } -.c15 > * + * { +.c22 > * + * { margin-top: 24px; } -.c17 { +.c24 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -340,154 +340,36 @@ exports[` renders and matches the snapshot 1`] = ` flex-direction: column; } -.c17 > * { +.c24 > * { margin-top: 0; margin-bottom: 0; } -.c17 > * + * { +.c24 > * + * { margin-top: 16px; } -.c6 > * { +.c13 > * { margin-left: 0; margin-right: 0; } -.c6 > * + * { +.c13 > * + * { margin-left: 8px; } -.c19 { +.c26 { font-weight: 500; font-size: 0.875rem; line-height: 1.43; color: #32324d; } -.c20 { - font-weight: 400; - font-size: 0.75rem; - line-height: 1.33; - color: #8e8ea9; -} - .c27 { - font-weight: 500; + font-weight: 400; font-size: 0.75rem; line-height: 1.33; - color: #32324d; -} - -.c26 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.c28 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: row; - -ms-flex-direction: row; - flex-direction: row; - -webkit-box-pack: justify; - -webkit-justify-content: space-between; - -ms-flex-pack: justify; - justify-content: space-between; - -webkit-align-items: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; -} - -.c30 { - border: none; - border-radius: 4px; - padding-left: 16px; - padding-right: 16px; - color: #32324d; - font-weight: 400; - font-size: 0.875rem; - display: block; - width: 100%; -} - -.c30::-webkit-input-placeholder { color: #8e8ea9; - opacity: 1; -} - -.c30::-moz-placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c30:-ms-input-placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c30::placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c30[aria-disabled='true'] { - background: inherit; - color: inherit; -} - -.c30:focus { - outline: none; - box-shadow: none; -} - -.c29 { - border: 1px solid #dcdce4; - border-radius: 4px; - background: #ffffff; - height: 2.5rem; - outline: none; - box-shadow: 0; - -webkit-transition-property: border-color,box-shadow,fill; - transition-property: border-color,box-shadow,fill; - -webkit-transition-duration: 0.2s; - transition-duration: 0.2s; -} - -.c29:focus-within { - border: 1px solid #4945ff; - box-shadow: #4945ff 0px 0px 0px 2px; -} - -.c25 { - display: -webkit-box; - display: -webkit-flex; - display: -ms-flexbox; - display: flex; - -webkit-flex-direction: column; - -ms-flex-direction: column; - flex-direction: column; -} - -.c25 > * { - margin-top: 0; - margin-bottom: 0; -} - -.c25 > * + * { - margin-top: 4px; } .c34 { @@ -512,13 +394,70 @@ exports[` renders and matches the snapshot 1`] = ` } .c35 { - border: 1px solid #dcdce4; + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-box-pack: justify; + -webkit-justify-content: space-between; + -ms-flex-pack: justify; + justify-content: space-between; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.c37 { + border: none; border-radius: 4px; padding-left: 16px; padding-right: 16px; - padding-top: 12px; - padding-bottom: 12px; + color: #32324d; + font-weight: 400; + font-size: 0.875rem; + display: block; + width: 100%; +} + +.c37::-webkit-input-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c37::-moz-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c37:-ms-input-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c37::placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c37[aria-disabled='true'] { + background: inherit; + color: inherit; +} + +.c37:focus { + outline: none; + box-shadow: none; +} + +.c36 { + border: 1px solid #dcdce4; + border-radius: 4px; background: #ffffff; + height: 2.5rem; outline: none; box-shadow: 0; -webkit-transition-property: border-color,box-shadow,fill; @@ -527,45 +466,11 @@ exports[` renders and matches the snapshot 1`] = ` transition-duration: 0.2s; } -.c35:focus-within { +.c36:focus-within { border: 1px solid #4945ff; box-shadow: #4945ff 0px 0px 0px 2px; } -.c36 { - display: block; - width: 100%; - font-weight: 400; - font-size: 0.875rem; - border: none; - color: #32324d; - resize: none; -} - -.c36::-webkit-input-placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c36::-moz-placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c36:-ms-input-placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c36::placeholder { - color: #8e8ea9; - opacity: 1; -} - -.c36:focus-within { - outline: none; -} - .c32 { display: -webkit-box; display: -webkit-flex; @@ -585,12 +490,107 @@ exports[` renders and matches the snapshot 1`] = ` margin-top: 4px; } -.c31 textarea { +.c41 { + font-weight: 500; + font-size: 0.75rem; + line-height: 1.33; + color: #32324d; +} + +.c40 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: row; + -ms-flex-direction: row; + flex-direction: row; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; +} + +.c42 { + border: 1px solid #dcdce4; + border-radius: 4px; + padding-left: 16px; + padding-right: 16px; + padding-top: 12px; + padding-bottom: 12px; + background: #ffffff; + outline: none; + box-shadow: 0; + -webkit-transition-property: border-color,box-shadow,fill; + transition-property: border-color,box-shadow,fill; + -webkit-transition-duration: 0.2s; + transition-duration: 0.2s; +} + +.c42:focus-within { + border: 1px solid #4945ff; + box-shadow: #4945ff 0px 0px 0px 2px; +} + +.c43 { + display: block; + width: 100%; + font-weight: 400; + font-size: 0.875rem; + border: none; + color: #32324d; + resize: none; +} + +.c43::-webkit-input-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c43::-moz-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c43:-ms-input-placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c43::placeholder { + color: #8e8ea9; + opacity: 1; +} + +.c43:focus-within { + outline: none; +} + +.c39 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + -webkit-flex-direction: column; + -ms-flex-direction: column; + flex-direction: column; +} + +.c39 > * { + margin-top: 0; + margin-bottom: 0; +} + +.c39 > * + * { + margin-top: 4px; +} + +.c38 textarea { height: 5rem; line-height: 1.25rem; } -.c31 textarea::-webkit-input-placeholder { +.c38 textarea::-webkit-input-placeholder { font-weight: 400; font-size: 0.875rem; line-height: 1.43; @@ -598,7 +598,7 @@ exports[` renders and matches the snapshot 1`] = ` opacity: 1; } -.c31 textarea::-moz-placeholder { +.c38 textarea::-moz-placeholder { font-weight: 400; font-size: 0.875rem; line-height: 1.43; @@ -606,7 +606,7 @@ exports[` renders and matches the snapshot 1`] = ` opacity: 1; } -.c31 textarea:-ms-input-placeholder { +.c38 textarea:-ms-input-placeholder { font-weight: 400; font-size: 0.875rem; line-height: 1.43; @@ -614,7 +614,7 @@ exports[` renders and matches the snapshot 1`] = ` opacity: 1; } -.c31 textarea::placeholder { +.c38 textarea::placeholder { font-weight: 400; font-size: 0.875rem; line-height: 1.43; @@ -622,24 +622,28 @@ exports[` renders and matches the snapshot 1`] = ` opacity: 1; } -.c38 { +.c45 { height: 100vh; } .c1 { background: #f6f6f9; - padding-top: 56px; + padding-top: 24px; padding-right: 56px; padding-bottom: 56px; padding-left: 56px; } -.c14 { +.c2 { + padding-bottom: 12px; +} + +.c21 { padding-right: 56px; padding-left: 56px; } -.c2 { +.c9 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -657,7 +661,7 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c3 { +.c10 { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -671,21 +675,21 @@ exports[` renders and matches the snapshot 1`] = ` align-items: center; } -.c4 { +.c11 { font-weight: 600; font-size: 2rem; line-height: 1.25; color: #32324d; } -.c12 { +.c19 { font-weight: 400; font-size: 0.875rem; line-height: 1.43; color: #666687; } -.c13 { +.c20 { font-size: 1rem; line-height: 1.5; } @@ -694,24 +698,108 @@ exports[` renders and matches the snapshot 1`] = ` outline: none; } -.c23 { +.c6 { + font-weight: 400; + font-size: 0.875rem; + line-height: 1.43; + color: #4945ff; +} + +.c7 { + font-weight: 600; + line-height: 1.14; +} + +.c8 { + font-weight: 600; + font-size: 0.6875rem; + line-height: 1.45; + text-transform: uppercase; +} + +.c4 { + padding-right: 8px; +} + +.c3 { + display: -webkit-inline-box; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + -webkit-align-items: center; + -webkit-box-align: center; + -ms-flex-align: center; + align-items: center; + text-transform: uppercase; + -webkit-text-decoration: none; + text-decoration: none; + position: relative; + outline: none; +} + +.c3 svg path { + fill: #4945ff; +} + +.c3 svg { + font-size: 0.625rem; +} + +.c3:after { + -webkit-transition-property: all; + transition-property: all; + -webkit-transition-duration: 0.2s; + transition-duration: 0.2s; + border-radius: 8px; + content: ''; + position: absolute; + top: -4px; + bottom: -4px; + left: -4px; + right: -4px; + border: 2px solid transparent; +} + +.c3:focus-visible { + outline: none; +} + +.c3:focus-visible:after { + border-radius: 8px; + content: ''; + position: absolute; + top: -5px; + bottom: -5px; + left: -5px; + right: -5px; + border: 2px solid #4945ff; +} + +.c5 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} + +.c30 { display: grid; grid-template-columns: repeat(12,1fr); gap: 16px; } -.c24 { +.c31 { grid-column: span 6; } @media (max-width:68.75rem) { - .c24 { + .c31 { grid-column: span; } } @media (max-width:34.375rem) { - .c24 { + .c31 { grid-column: span; } } @@ -731,27 +819,59 @@ exports[` renders and matches the snapshot 1`] = ` > +

Edit a role

Define the rights given to the role

renders and matches the snapshot 1`] = ` class="" >
renders and matches the snapshot 1`] = `
renders and matches the snapshot 1`] = `