mirror of
https://github.com/logto-io/logto.git
synced 2025-02-17 22:04:19 -05:00
refactor(console): show connector readme content in drawer
This commit is contained in:
parent
060ff2125f
commit
2c66397c35
8 changed files with 47 additions and 28 deletions
|
@ -9,19 +9,25 @@
|
|||
max-width: 900px;
|
||||
min-width: 770px;
|
||||
outline: none;
|
||||
background: var(--color-layer-1);
|
||||
overflow-y: auto;
|
||||
background: var(--color-base);
|
||||
|
||||
.headline {
|
||||
.wrapper {
|
||||
display: flex;
|
||||
justify-content: right;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
|
||||
> svg {
|
||||
cursor: pointer;
|
||||
.header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-shrink: 0;
|
||||
background-color: var(--color-layer-1);
|
||||
height: 64px;
|
||||
padding: 0 _.unit(6);
|
||||
}
|
||||
|
||||
.closeIcon {
|
||||
color: var(--color-icon);
|
||||
.body {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
import { AdminConsoleKey } from '@logto/phrases';
|
||||
import React from 'react';
|
||||
import ReactModal from 'react-modal';
|
||||
|
||||
import Close from '@/icons/Close';
|
||||
|
||||
import CardTitle from '../CardTitle';
|
||||
import IconButton from '../IconButton';
|
||||
import Spacer from '../Spacer';
|
||||
import * as styles from './index.module.scss';
|
||||
|
||||
type Props = {
|
||||
title?: AdminConsoleKey;
|
||||
subtitle?: AdminConsoleKey;
|
||||
isOpen: boolean;
|
||||
onClose?: () => void;
|
||||
children: React.ReactNode;
|
||||
onClose?: () => void;
|
||||
};
|
||||
|
||||
const Drawer = ({ isOpen, onClose, children }: Props) => {
|
||||
const Drawer = ({ title, subtitle, isOpen, children, onClose }: Props) => {
|
||||
return (
|
||||
<ReactModal
|
||||
shouldCloseOnOverlayClick
|
||||
|
@ -23,14 +28,18 @@ const Drawer = ({ isOpen, onClose, children }: Props) => {
|
|||
closeTimeoutMS={300}
|
||||
onRequestClose={onClose}
|
||||
>
|
||||
{onClose && (
|
||||
<div className={styles.headline}>
|
||||
<IconButton size="large" onClick={onClose}>
|
||||
<Close className={styles.closeIcon} />
|
||||
</IconButton>
|
||||
</div>
|
||||
)}
|
||||
<div>{children}</div>
|
||||
<div className={styles.wrapper}>
|
||||
{title && (
|
||||
<div className={styles.header}>
|
||||
<CardTitle size="small" title={title} subtitle={subtitle} />
|
||||
<Spacer />
|
||||
<IconButton size="large" onClick={onClose}>
|
||||
<Close />
|
||||
</IconButton>
|
||||
</div>
|
||||
)}
|
||||
<div className={styles.body}>{children}</div>
|
||||
</div>
|
||||
</ReactModal>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -97,6 +97,10 @@ const ApplicationDetails = () => {
|
|||
toast.success(t('application_details.save_success'));
|
||||
});
|
||||
|
||||
const onCloseDrawer = () => {
|
||||
setIsReadmeOpen(false);
|
||||
};
|
||||
|
||||
const isAdvancedSettings = location.pathname.includes('advanced-settings');
|
||||
|
||||
return (
|
||||
|
@ -129,14 +133,8 @@ const ApplicationDetails = () => {
|
|||
setIsReadmeOpen(true);
|
||||
}}
|
||||
/>
|
||||
<Drawer isOpen={isReadmeOpen}>
|
||||
<Guide
|
||||
isCompact
|
||||
app={data}
|
||||
onClose={() => {
|
||||
setIsReadmeOpen(false);
|
||||
}}
|
||||
/>
|
||||
<Drawer isOpen={isReadmeOpen} onClose={onCloseDrawer}>
|
||||
<Guide isCompact app={data} onClose={onCloseDrawer} />
|
||||
</Drawer>
|
||||
<ActionMenu
|
||||
buttonProps={{ icon: <More className={styles.moreIcon} />, size: 'large' }}
|
||||
|
|
|
@ -95,5 +95,5 @@
|
|||
}
|
||||
|
||||
.readme {
|
||||
margin-top: _.unit(-6);
|
||||
padding: 0 _.unit(6);
|
||||
}
|
||||
|
|
|
@ -152,6 +152,8 @@ const ConnectorDetails = () => {
|
|||
}}
|
||||
/>
|
||||
<Drawer
|
||||
title="connectors.title"
|
||||
subtitle="connectors.subtitle"
|
||||
isOpen={isReadMeOpen}
|
||||
onClose={() => {
|
||||
setIsReadMeOpen(false);
|
||||
|
|
|
@ -32,7 +32,7 @@ const ConnectorRow = ({ type, connectors, onClickSetup }: Props) => {
|
|||
};
|
||||
|
||||
return (
|
||||
<tr className={conditional(showSetupButton && tableStyles.clickable)} onClick={handleClickRow}>
|
||||
<tr className={conditional(!showSetupButton && tableStyles.clickable)} onClick={handleClickRow}>
|
||||
<td>
|
||||
<ConnectorName type={type} connectors={connectors} onClickSetup={onClickSetup} />
|
||||
</td>
|
||||
|
|
|
@ -274,6 +274,8 @@ const translation = {
|
|||
native: 'Native',
|
||||
},
|
||||
add_multi_platform: ' supports multiple platform, select a platform to continue',
|
||||
drawer_title: 'Connector Guide',
|
||||
drawer_subtitle: 'Follow the instructions to integrate your connector',
|
||||
},
|
||||
connector_details: {
|
||||
back_to_connectors: 'Back to Connectors',
|
||||
|
|
|
@ -269,6 +269,8 @@ const translation = {
|
|||
native: '原生',
|
||||
},
|
||||
add_multi_platform: ' 支持多平台,请选择一个平台继续',
|
||||
drawer_title: '连接器配置指南',
|
||||
drawer_subtitle: '请参考下列连接器配置指南',
|
||||
},
|
||||
connector_details: {
|
||||
back_to_connectors: '返回连接器',
|
||||
|
|
Loading…
Add table
Reference in a new issue