mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-26 19:21:30 +01:00
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import React, { useState } from 'react';
|
|
|
|
import useInterval from '../../hooks/useInterval';
|
|
import DetailsLayout from '../../layouts/DetailsLayout';
|
|
import BrowserFrame from '../../placeholders/BrowserFrame';
|
|
|
|
const Details: React.FC<{}> = () => {
|
|
const [progress, setProgress] = useState(0);
|
|
useInterval(() => {
|
|
setProgress((v) => v === 100 ? 0 : v + 1);
|
|
}, 1 * 100);
|
|
|
|
return (
|
|
<DetailsLayout title="Progress bar">
|
|
<div className="ph4 pv5">
|
|
<BrowserFrame
|
|
content={(
|
|
<div className="h-100 flex flex-column items-center justify-center">
|
|
<div className="h1 w-50 br-pill bg-black-10">
|
|
<div
|
|
className="br-pill h-100 bg-blue flex items-center justify-center pa1 white f7"
|
|
style={{ width: `${progress}%` }}
|
|
>
|
|
{progress}%
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)}
|
|
source={`
|
|
<div style="
|
|
/* Colors */
|
|
background-color: rgba(0, 0, 0, .1);
|
|
|
|
/* Rounded border */
|
|
border-radius: 9999px;
|
|
">
|
|
<div style="
|
|
/* Content is centered */
|
|
align-items: center;
|
|
display: flex;
|
|
justify-content: center;
|
|
|
|
/* Colors */
|
|
background-color: #357edd;
|
|
color: #fff;
|
|
|
|
/* Rounded border */
|
|
border-radius: 9999px;
|
|
|
|
/* Width based on the number of percentages */
|
|
width: 40%;
|
|
">
|
|
<!-- The number of percentages -->
|
|
40%
|
|
</div>
|
|
</div>
|
|
`}
|
|
/>
|
|
</div>
|
|
</DetailsLayout>
|
|
);
|
|
};
|
|
|
|
export default Details;
|