aboutsummaryrefslogtreecommitdiff
path: root/src/components/common/GradientProgressBar.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-07-20 17:35:20 -0400
committerIvan Chen <ivan@tagg.id>2021-07-20 17:35:20 -0400
commit142c84c7c45411b9badf7da3182c9e4bd0e96e38 (patch)
treeccbdff21ab93e6b82ce0887af1d13bca72ae184d /src/components/common/GradientProgressBar.tsx
parent7d57106ae614e42ea1d7d871a098e0acefc83762 (diff)
Add gradient progress bar
Diffstat (limited to 'src/components/common/GradientProgressBar.tsx')
-rw-r--r--src/components/common/GradientProgressBar.tsx45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/components/common/GradientProgressBar.tsx b/src/components/common/GradientProgressBar.tsx
new file mode 100644
index 00000000..3483f8ac
--- /dev/null
+++ b/src/components/common/GradientProgressBar.tsx
@@ -0,0 +1,45 @@
+import React, {FC} from 'react';
+import {StyleSheet, View, ViewProps} from 'react-native';
+import LinearGradient from 'react-native-linear-gradient';
+import {
+ TAGG_LIGHT_BLUE_2,
+ TAGG_LIGHT_BLUE_3,
+ TAGG_PURPLE,
+} from '../../constants';
+import {normalize, SCREEN_WIDTH} from '../../utils';
+
+interface GradientProgressBarProps extends ViewProps {
+ progress: number;
+}
+
+const GradientProgressBar: FC<GradientProgressBarProps> = ({
+ style,
+ progress,
+}) => {
+ return (
+ <LinearGradient
+ style={[styles.bar, style]}
+ useAngle={true}
+ colors={[TAGG_PURPLE, TAGG_LIGHT_BLUE_2]}>
+ <View style={[styles.blank, {width: `${(1 - progress) * 100}%`}]} />
+ </LinearGradient>
+ );
+};
+const styles = StyleSheet.create({
+ container: {
+ borderRadius: 6.5,
+ },
+ bar: {
+ width: SCREEN_WIDTH * 0.9,
+ height: normalize(10),
+ borderRadius: 6.5,
+ },
+ blank: {
+ alignSelf: 'flex-end',
+ height: normalize(10),
+ width: '80%',
+ backgroundColor: TAGG_LIGHT_BLUE_3,
+ },
+});
+
+export default GradientProgressBar;