0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-17 22:04:19 -05:00

refactor(experience): hide nav bar on backup code binding page (#4774)

This commit is contained in:
Xiao Yijun 2023-10-27 10:42:56 +08:00 committed by GitHub
parent eee6203d6e
commit 752584218f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 5 deletions

View file

@ -14,9 +14,10 @@ type Props = {
title: TFuncKey;
description?: TFuncKey | ReactElement | '';
titleProps?: Record<string, unknown>;
onSkip?: () => void;
descriptionProps?: Record<string, unknown>;
notification?: TFuncKey;
onSkip?: () => void;
isNavBarHidden?: boolean;
children: React.ReactNode;
};
@ -24,9 +25,10 @@ const SecondaryPageLayout = ({
title,
description,
titleProps,
onSkip,
descriptionProps,
notification,
onSkip,
isNavBarHidden,
children,
}: Props) => {
const { isMobile } = usePlatform();
@ -34,7 +36,7 @@ const SecondaryPageLayout = ({
return (
<div className={styles.wrapper}>
<PageMeta titleKey={title} />
<NavBar onSkip={onSkip} />
<NavBar isHidden={isNavBarHidden} onSkip={onSkip} />
{isMobile && notification && (
<InlineNotification message={notification} className={styles.notification} />
)}

View file

@ -43,6 +43,10 @@
.navButton > span {
display: none;
}
.navBar.hidden {
visibility: hidden;
}
}
:global(body.desktop) {
@ -59,4 +63,8 @@
text-decoration: underline;
}
}
.navBar.hidden {
display: none;
}
}

View file

@ -1,3 +1,4 @@
import classNames from 'classnames';
import { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
@ -11,11 +12,12 @@ import * as styles from './index.module.scss';
type Props = {
title?: string;
type?: 'back' | 'close';
isHidden?: boolean;
onClose?: () => void;
onSkip?: () => void;
};
const NavBar = ({ title, type = 'back', onClose, onSkip }: Props) => {
const NavBar = ({ title, type = 'back', isHidden, onClose, onSkip }: Props) => {
const navigate = useNavigate();
const { t } = useTranslation();
@ -38,7 +40,7 @@ const NavBar = ({ title, type = 'back', onClose, onSkip }: Props) => {
}, [isClosable, navigate, onClose]);
return (
<div className={styles.navBar}>
<div className={classNames(styles.navBar, isHidden && styles.hidden)}>
<div
role="button"
tabIndex={0}

View file

@ -31,6 +31,7 @@ const BackupCodeBinding = () => {
return (
<SecondaryPageLayout
isNavBarHidden
title="mfa.save_backup_code"
description="mfa.save_backup_code_description"
>