0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

feat(console): progress bar on cloud page (#3139)

This commit is contained in:
Xiao Yijun 2023-02-17 16:26:32 +08:00 committed by GitHub
parent 36966ad590
commit 6f94615596
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 61 additions and 11 deletions

View file

@ -1,11 +1,15 @@
@use '@/scss/underscore' as _;
.container {
height: 92px;
background-color: var(--color-layer-1);
padding: 0 _.unit(17);
display: flex;
align-items: center;
flex-direction: row-reverse;
justify-content: space-between;
height: 80px;
.actions {
height: 100%;
background-color: var(--color-layer-1);
padding: 0 _.unit(17);
display: flex;
align-items: center;
flex-direction: row-reverse;
justify-content: space-between;
}
}

View file

@ -1,11 +1,20 @@
import type { ReactNode } from 'react';
import ProgressBar from '../ProgressBar';
import * as styles from './index.module.scss';
type Props = {
step: number;
children: ReactNode;
};
const ActionBar = ({ children }: Props) => <div className={styles.container}>{children}</div>;
const totalSteps = 4;
const ActionBar = ({ step, children }: Props) => (
<div className={styles.container}>
<ProgressBar currentStep={step} totalSteps={totalSteps} />
<div className={styles.actions}>{children}</div>
</div>
);
export default ActionBar;

View file

@ -0,0 +1,16 @@
@use '@/scss/underscore' as _;
.progressBar {
display: flex;
gap: _.unit(1);
.stepIndicator {
height: 4px;
background-color: var(--color-neutral-variant-80);
flex: 1;
&.active {
background-color: var(--color-text-link);
}
}
}

View file

@ -0,0 +1,21 @@
import classNames from 'classnames';
import * as styles from './index.module.scss';
type Props = {
currentStep: number;
totalSteps: number;
};
const ProgressBar = ({ currentStep, totalSteps }: Props) => (
<div className={styles.progressBar}>
{Array.from({ length: totalSteps }, (_, i) => i + 1).map((step) => (
<div
key={step}
className={classNames(styles.stepIndicator, step <= currentStep && styles.active)}
/>
))}
</div>
);
export default ProgressBar;

View file

@ -101,7 +101,7 @@ const About = () => {
</form>
</div>
</OverlayScrollbar>
<ActionBar>
<ActionBar step={2}>
<Button title="general.next" type="primary" onClick={onNext} />
<Button title="general.back" onClick={onBack} />
</ActionBar>

View file

@ -74,7 +74,7 @@ const Congrats = () => {
</div>
</div>
</OverlayScrollbar>
<ActionBar>
<ActionBar step={4}>
<Button
type="primary"
title="cloud.congrats.enter_admin_console"

View file

@ -83,7 +83,7 @@ const Welcome = () => {
</form>
</div>
</OverlayScrollbar>
<ActionBar>
<ActionBar step={1}>
<Button
title="general.next"
type="primary"