@chakra-ui/react#Progress TypeScript Examples
The following examples show how to use
@chakra-ui/react#Progress.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UploadButton.tsx From ke with MIT License | 6 votes |
function UploadingList({ files }: UploadingListProps): ReactElement<UploadingListProps> {
return (
<List>
{files.map((file) => (
<ListItem key={file.key}>
<ListIcon as={Loader} />
{file.name}
<Progress hasStripe isAnimated value={Math.floor((file.loaded / file.total) * 100)} />
</ListItem>
))}
</List>
)
}
Example #2
Source File: index.tsx From formik-chakra-ui with MIT License | 6 votes |
PercentComplete: FC<PercentCompleteProps> = (
props: PercentCompleteProps
) => {
const { progressFn = calculateProgress, progressProps, ...rest } = props;
const { errors, values, validateForm, dirty } = useFormikContext();
const numFields = Object.keys(values as object).length;
const numErrors = Object.keys(errors).length;
useEffect(() => {
validateForm();
}, [dirty]);
return (
<Box marginY={5} {...rest}>
<Progress
hasStripe
isAnimated
value={progressFn(numFields, numErrors)}
{...progressProps}
/>
</Box>
);
}
Example #3
Source File: Recommend.tsx From phonepare with MIT License | 6 votes |
Recommend : FC = () => {
const [ questionIndex, setQuestionIndex ] = useRecoilState(questionIndexState)
const [ questionTags, setQuestionTags ] = useRecoilState(questionTagsState)
const setSelecetedPhones = useSetRecoilState(selectedPhonesState)
return <Box py={10} textAlign='center'>
<Heading mb={3}>폰 추천받기</Heading>
{
questionIndex < Questions.length ? <Box px={{ base: 10, md: 32 }}>
<Flex height='60vh' alignItems='center' justifyContent='center'>
<Box>
<Heading fontSize='2xl'>{Questions[questionIndex].question}</Heading>
<Progress mt={4} mb={6} value={questionIndex} max={Questions.length} size='md' rounded='2xl' />
<Grid templateColumns={{ base: 'repeat(1, 1fr)', md: 'repeat(2, 1fr)' }} gap={5}>
{
Questions[questionIndex].options.map((option, index) => <Card key={index} onClick={() => {
setQuestionTags({ ...questionTags, [Questions[questionIndex].id]: option.value })
setQuestionIndex(questionIndex + 1)
if(questionIndex < Questions.length) setSelecetedPhones(getRecommended(questionTags).map(x => x.data.id) as [ string, string, string ])
}}>
<Text>{option.subLabel}</Text>
<Heading fontSize='xl'>{option.label}</Heading>
</Card>
)
}
</Grid>
</Box>
</Flex>
</Box> : <Box>
<Heading fontSize='2xl'>아래 휴대폰을 추천드립니다!</Heading>
<Button mt={4} onClick={() => setQuestionIndex(0)}>다시 고르기</Button>
<Compare asComponent />
</Box>
}
</Box>
}
Example #4
Source File: FusePoolPage.tsx From rari-dApp with GNU Affero General Public License v3.0 | 5 votes |
CollateralRatioBar = ({
assets,
borrowUSD,
}: {
assets: USDPricedFuseAsset[];
borrowUSD: number;
}) => {
const { t } = useTranslation();
const maxBorrow = useBorrowLimit(assets);
const borrowPercent = borrowUSD / maxBorrow;
const ratio = isNaN(borrowPercent) ? 0 : borrowPercent * 100;
useEffect(() => {
if (ratio > 95) {
LogRocket.track("Fuse-AtRiskOfLiquidation");
}
}, [ratio]);
return (
<DashboardBox width="100%" height="65px" mt={4} p={4}>
<Row mainAxisAlignment="flex-start" crossAxisAlignment="center" expand>
<SimpleTooltip
label={t("Keep this bar from filling up to avoid being liquidated!")}
>
<Text flexShrink={0} mr={4}>
{t("Borrow Limit")}
</Text>
</SimpleTooltip>
<SimpleTooltip label={t("This is how much you have borrowed.")}>
<Text flexShrink={0} mt="2px" mr={3} fontSize="10px">
{smallUsdFormatter(borrowUSD)}
</Text>
</SimpleTooltip>
<SimpleTooltip
label={`You're using ${ratio.toFixed(1)}% of your ${smallUsdFormatter(
maxBorrow
)} borrow limit.`}
>
<Box width="100%">
<Progress
size="xs"
width="100%"
colorScheme={
ratio <= 40
? "whatsapp"
: ratio <= 60
? "yellow"
: ratio <= 80
? "orange"
: "red"
}
borderRadius="10px"
value={ratio}
/>
</Box>
</SimpleTooltip>
<SimpleTooltip
label={t(
"If your borrow amount reaches this value, you will be liquidated."
)}
>
<Text flexShrink={0} mt="2px" ml={3} fontSize="10px">
{smallUsdFormatter(maxBorrow)}
</Text>
</SimpleTooltip>
</Row>
</DashboardBox>
);
}
Example #5
Source File: PiggybankLimitUtilization.tsx From coindrop with GNU General Public License v3.0 | 5 votes |
PiggybankLimitUtilization: FunctionComponent<Props> = ({ numActivePiggybanks }) => {
const pctUtilization = (numActivePiggybanks / maxPiggybanksPerUser) * 100;
let color = 'blue';
if (pctUtilization >= 90) {
color = 'red';
} else if (pctUtilization >= 80) {
color = 'orange';
} else if (pctUtilization >= 70) {
color = 'yellow';
}
if (pctUtilization >= 50) {
return (
<Box
textAlign="center"
py={4}
>
<Progress
value={pctUtilization}
colorScheme={color}
size="sm"
/>
<Flex wrap="wrap" justify="space-around">
<Text mt={2}>
{"You're using "}
{numActivePiggybanks}
/
{maxPiggybanksPerUser}
{' Coindrops'}
</Text>
<Text mt={2}>
<Link href={`mailto:${coindropEmail}`} target="_blank" rel="noreferrer">
<u>Contact us</u>
</Link>
{" to request a limit increase (it's free)"}
</Text>
</Flex>
</Box>
);
}
return null;
}