From 2a9a9263ea4b3445e9ed6ebd06930f8a7c2cbb91 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Tue, 12 Sep 2023 20:48:56 +0800 Subject: [PATCH] feat(console): add guide support in api resource creation process (#4457) * feat(console): add guide support in api resource creation process * fix(test): ui integration test --- .../Guide/ModalFooter/index.module.scss | 6 - .../components/Guide/ModalFooter/index.tsx | 6 +- .../console/src/components/Guide/hooks.ts | 8 +- .../src/containers/ConsoleContent/index.tsx | 1 + .../components/ApiGuide/index.tsx | 36 +++++ .../components/GuideDrawer/index.module.scss | 37 +++++ .../components/GuideDrawer/index.tsx | 71 ++++++++ .../components/GuideModal/index.module.scss | 19 +++ .../components/GuideModal/index.tsx | 34 ++++ .../src/pages/ApiResourceDetails/index.tsx | 36 ++++- .../components/CreateForm/index.tsx | 142 ++++++++-------- .../components/GuideLibrary/index.module.scss | 39 +++++ .../components/GuideLibrary/index.tsx | 69 ++++++++ .../GuideLibraryModal/index.module.scss | 20 +++ .../components/GuideLibraryModal/index.tsx | 63 ++++++++ .../console/src/pages/ApiResources/index.tsx | 153 ++++++++---------- .../components/GuideLibrary/index.tsx | 2 +- .../GuideLibraryModal/index.module.scss | 6 + .../components/GuideLibraryModal/index.tsx | 1 + .../src/tests/console/rbac.test.ts | 7 + .../zh-cn/translation/admin-console/guide.ts | 2 +- 21 files changed, 592 insertions(+), 166 deletions(-) create mode 100644 packages/console/src/pages/ApiResourceDetails/components/ApiGuide/index.tsx create mode 100644 packages/console/src/pages/ApiResourceDetails/components/GuideDrawer/index.module.scss create mode 100644 packages/console/src/pages/ApiResourceDetails/components/GuideDrawer/index.tsx create mode 100644 packages/console/src/pages/ApiResourceDetails/components/GuideModal/index.module.scss create mode 100644 packages/console/src/pages/ApiResourceDetails/components/GuideModal/index.tsx create mode 100644 packages/console/src/pages/ApiResources/components/GuideLibrary/index.module.scss create mode 100644 packages/console/src/pages/ApiResources/components/GuideLibrary/index.tsx create mode 100644 packages/console/src/pages/ApiResources/components/GuideLibraryModal/index.module.scss create mode 100644 packages/console/src/pages/ApiResources/components/GuideLibraryModal/index.tsx diff --git a/packages/console/src/components/Guide/ModalFooter/index.module.scss b/packages/console/src/components/Guide/ModalFooter/index.module.scss index 50bed48bd..f2121a66a 100644 --- a/packages/console/src/components/Guide/ModalFooter/index.module.scss +++ b/packages/console/src/components/Guide/ModalFooter/index.module.scss @@ -24,9 +24,3 @@ @include _.multi-line-ellipsis(2); } } - -@media screen and (max-width: dim.$guide-content-max-width) { - .actionBar .wrapper { - margin: 0 0 0 _.unit(62.5); - } -} diff --git a/packages/console/src/components/Guide/ModalFooter/index.tsx b/packages/console/src/components/Guide/ModalFooter/index.tsx index 73b48d5b4..5a0417467 100644 --- a/packages/console/src/components/Guide/ModalFooter/index.tsx +++ b/packages/console/src/components/Guide/ModalFooter/index.tsx @@ -1,4 +1,5 @@ import { type AdminConsoleKey } from '@logto/phrases'; +import classNames from 'classnames'; import Button from '@/ds-components/Button'; import DynamicT from '@/ds-components/DynamicT'; @@ -6,15 +7,16 @@ import DynamicT from '@/ds-components/DynamicT'; import * as styles from './index.module.scss'; type Props = { + wrapperClassName?: string; content: AdminConsoleKey; buttonText: AdminConsoleKey; onClick: () => void; }; -export default function ModalFooter({ content, buttonText, onClick }: Props) { +export default function ModalFooter({ wrapperClassName, content, buttonText, onClick }: Props) { return (