import { Box, Flex } from '@chakra-ui/react' import * as React from 'react' type Enumerate = Acc['length'] extends N ? Acc[number] : Enumerate type Range = Exclude, Enumerate> type ColorSchema = 'green' | 'blue' | 'purple' | 'yellow' | 'orange' | 'white' | 'red' interface ICustomProgressProps { value: Range<1, 101> colorSchema?: ColorSchema } const mapColorSchemaToStyles = (color: ColorSchema) => { switch (color) { case 'green': return { bg: 'linear-gradient(90deg, rgba(122, 235, 228, 0.314), rgb(122, 235, 228))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(122, 235, 228) 0%, rgba(122, 235, 228, 0.004) 75.52%, rgba(122, 235, 228, 0.004) 88.54%, rgba(122, 235, 228, 0) 100%)', dotBg: 'rgba(122, 235, 228, 0.44)', border: 'rgba(122, 235, 228, 0.44)', } case 'blue': return { bg: 'linear-gradient(90deg, rgba(69, 143, 255, 0.314), rgb(69, 143, 255))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(69, 143, 255) 0%, rgba(69, 143, 255, 0.004) 75.52%, rgba(69, 143, 255, 0.004) 88.54%, rgba(69, 143, 255, 0) 100%)', dotBg: 'rgba(69, 143, 255, 0.44)', border: '1px solid rgb(69, 143, 255)', } case 'yellow': return { bg: 'linear-gradient(90deg, rgba(215, 255, 103, 0.314), rgb(215, 255, 103))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(215, 255, 103) 0%, rgba(215, 255, 103, 0.004) 75.52%, rgba(215, 255, 103, 0.004) 88.54%, rgba(215, 255, 103, 0) 100%)', dotBg: 'rgba(215, 255, 103, 0.44)', border: '1px solid rgb(215, 255, 103)', } case 'purple': return { bg: 'linear-gradient(90deg, rgba(123, 97, 255, 0.314), rgb(123, 97, 255))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(123, 97, 255) 0%, rgba(123, 97, 255, 0.004) 75.52%, rgba(123, 97, 255, 0.004) 88.54%, rgba(123, 97, 255, 0) 100%)', dotBg: 'rgb(123, 97, 255, 0.44)', border: '1px solid rgb(123, 97, 255)', } case 'orange': return { bg: 'linear-gradient(90deg, rgba(237, 137, 54, 0.314), rgb(237, 137, 54))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(237, 137, 54) 0%, rgba(123, 97, 255, 0.004) 75.52%, rgba(123, 97, 255, 0.004) 88.54%, rgba(123, 97, 255, 0) 100%)', dotBg: 'rgb(237, 137, 54, 0.44)', border: '1px solid rgb(237, 137, 54)', } case 'red': return { bg: 'linear-gradient(90deg, rgba(245, 101, 101, 0.314), rgb(245, 101, 101))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(245, 101, 101) 0%, rgba(123, 97, 255, 0.004) 75.52%, rgba(123, 97, 255, 0.004) 88.54%, rgba(123, 97, 255, 0) 100%)', dotBg: 'rgb(245, 101, 101, 0.44)', border: '1px solid rgb(245, 101, 101)', } default: return { bg: 'linear-gradient(90deg, rgba(247, 250, 252, 0.314), rgb(247, 250, 252))', progressBg: 'radial-gradient(50% 50% at 100% 50%, rgb(247, 250, 252) 0%, rgba(247, 250, 252, 0.004) 75.52%, rgba(247, 250, 252, 0.004) 88.54%, rgba(247, 250, 252, 0) 100%)', dotBg: 'rgba(247, 250, 252, 0.44)', border: 'rgba(247, 250, 252, 0.44)', } } } const CustomProgress: React.FunctionComponent = ({ value, colorSchema = 'blue' }) => { const styles = mapColorSchemaToStyles(colorSchema) return ( ) } export default CustomProgress