1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 10:46:13 +02:00
Files
csslayout/pages/wizard/index.tsx
2021-09-27 23:14:35 +07:00

197 lines
7.7 KiB
TypeScript

import * as React from 'react';
import Head from 'next/head';
import { Pattern } from '../../constants/Pattern';
import { PatternLayout } from '../../layouts/PatternLayout';
import Block from '../../placeholders/Block';
import BrowserFrame from '../../placeholders/BrowserFrame';
import Circle from '../../placeholders/Circle';
import Line from '../../placeholders/Line';
const Details: React.FC<{}> = () => {
return (
<PatternLayout pattern={Pattern.Wizard}>
<Head>
<meta name="description" content="Create a wizard with CSS flexbox" />
<meta name="og:description" content="Create a wizard with CSS flexbox" />
<meta name="twitter:description" content="Create a wizard with CSS flexbox" />
<meta name="keywords" content="css flexbox, css stepper, css wizard" />
</Head>
<BrowserFrame
html={`
<div class="wizard">
<!-- Step -->
<div class="wizard__step">
<div class="wizard__dot">
<!-- The left connector -->
<div class="wizard__connector"></div>
<!-- The step number -->
<div class="wizard__number">
...
</div>
<!-- The right connector -->
<div class="wizard__connector"></div>
</div>
<!-- Title of step -->
...
</div>
<!-- Repeat other steps -->
...
</div>
`}
css={`
.wizard {
display: flex;
}
.wizard__step {
/* Make all steps have the same width */
flex: 1;
}
.wizard__dot {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
}
.wizard__connector {
flex: 1;
height: 1px;
background-color: rgba(0, 0, 0, 0.3);
}
.wizard__step:first-child .wizard__connector,
.wizard__step:last-child .wizard__connector {
background-color: transparent;
}
.wizard__number {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
/* Rounded border */
background-color: rgba(0, 0, 0, 0.3);
border-radius: 9999px;
height: 32px;
width: 32px;
/* OPTIONAL: Spacing between it and connectors */
margin-left: 4px;
margin-right: 4px;
}
`}
>
<div
style={{
alignItems: 'center',
display: 'flex',
flexDirection: 'column',
height: '100%',
justifyContent: 'center',
padding: '8px',
}}
>
<div style={{ display: 'flex', width: '80%' }}>
<div style={{ flex: 1 }}>
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
marginBottom: '16px',
}}
>
<div style={{ flex: 1 }} />
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
margin: '0 4px',
}}
>
<Circle size={32} />
</div>
<div style={{ flex: 1 }}>
<Line />
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'center', padding: '0 16px' }}>
<Block justify="center" numberOfBlocks={5} />
</div>
</div>
<div style={{ flex: 1 }}>
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
marginBottom: '16px',
}}
>
<div style={{ flex: 1 }}>
<Line />
</div>
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
margin: '0 4px',
}}
>
<Circle size={32} />
</div>
<div style={{ flex: 1 }}>
<Line />
</div>
</div>
<div style={{ display: 'flex', justifyContent: 'center', padding: '0 16px' }}>
<Block justify="center" numberOfBlocks={5} />
</div>
</div>
<div style={{ flex: 1 }}>
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
marginBottom: '16px',
}}
>
<div style={{ flex: 1 }}>
<Line />
</div>
<div
style={{
alignItems: 'center',
display: 'flex',
justifyContent: 'center',
margin: '0 4px',
}}
>
<Circle size={32} />
</div>
<div style={{ flex: 1 }} />
</div>
<div style={{ display: 'flex', justifyContent: 'center', padding: '0 16px' }}>
<Block justify="center" numberOfBlocks={5} />
</div>
</div>
</div>
</div>
</BrowserFrame>
</PatternLayout>
);
};
export default Details;