forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[docs][joy-ui] Integrate a count-up feature to the Linear Progress (m…
- Loading branch information
Showing
6 changed files
with
117 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
docs/data/joy/components/linear-progress/LinearProgressCountUp.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as React from 'react'; | ||
import LinearProgress from '@mui/joy/LinearProgress'; | ||
import Typography from '@mui/joy/Typography'; | ||
import { useCountUp } from 'use-count-up'; | ||
|
||
export default function LinearProgressCountUp() { | ||
const { value } = useCountUp({ | ||
isCounting: true, | ||
duration: 5, | ||
easing: 'linear', | ||
start: 0, | ||
end: 75, | ||
onComplete: () => ({ | ||
shouldRepeat: true, | ||
delay: 2, | ||
}), | ||
}); | ||
|
||
return ( | ||
<LinearProgress | ||
determinate | ||
variant="outlined" | ||
color="neutral" | ||
size="sm" | ||
thickness={24} | ||
value={Number(value)} | ||
sx={{ | ||
'--LinearProgress-radius': '20px', | ||
'--LinearProgress-thickness': '24px', | ||
}} | ||
> | ||
<Typography | ||
level="body-xs" | ||
fontWeight="xl" | ||
textColor="common.white" | ||
sx={{ mixBlendMode: 'difference' }} | ||
> | ||
LOADING… {`${Math.round(Number(value))}%`} | ||
</Typography> | ||
</LinearProgress> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
docs/data/joy/components/linear-progress/LinearProgressCountUp.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import * as React from 'react'; | ||
import LinearProgress from '@mui/joy/LinearProgress'; | ||
import Typography from '@mui/joy/Typography'; | ||
import { useCountUp } from 'use-count-up'; | ||
|
||
export default function LinearProgressCountUp() { | ||
const { value } = useCountUp({ | ||
isCounting: true, | ||
duration: 5, | ||
easing: 'linear', | ||
start: 0, | ||
end: 75, | ||
onComplete: () => ({ | ||
shouldRepeat: true, | ||
delay: 2, | ||
}), | ||
}); | ||
|
||
return ( | ||
<LinearProgress | ||
determinate | ||
variant="outlined" | ||
color="neutral" | ||
size="sm" | ||
thickness={24} | ||
value={Number(value!)} | ||
sx={{ | ||
'--LinearProgress-radius': '20px', | ||
'--LinearProgress-thickness': '24px', | ||
}} | ||
> | ||
<Typography | ||
level="body-xs" | ||
fontWeight="xl" | ||
textColor="common.white" | ||
sx={{ mixBlendMode: 'difference' }} | ||
> | ||
LOADING… {`${Math.round(Number(value!))}%`} | ||
</Typography> | ||
</LinearProgress> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16552,6 +16552,18 @@ [email protected]: | |
punycode "1.3.2" | ||
querystring "0.2.0" | ||
|
||
use-count-up@^3.0.1: | ||
version "3.0.1" | ||
resolved "https://registry.yarnpkg.com/use-count-up/-/use-count-up-3.0.1.tgz#315edf4e4be91ead94e6dd34444349d9b8c2c6c3" | ||
integrity sha512-jlVsXJYje6jh+xwQaCEYrwHoB+nRyillNEmr21bhe9kw7tpRzyrSq9jQs9UOlo+8hCFkuOmjUihL3IjEK/piVg== | ||
dependencies: | ||
use-elapsed-time "3.0.2" | ||
|
||
[email protected]: | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/use-elapsed-time/-/use-elapsed-time-3.0.2.tgz#ef22bf520e60f9873fd102925a2d5cbc5d4faaf5" | ||
integrity sha512-2EY9lJ5DWbAvT8wWiEp6Ztnl46DjXz2j78uhWbXaz/bg3OfpbgVucCAlcN8Bih6hTJfFTdVYX9L6ySMn5py/wQ== | ||
|
||
use-sync-external-store@^1.0.0: | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" | ||
|