Initial version of PDF export
This commit is contained in:
51
src/exams/pdf/progress.bar.tsx
Normal file
51
src/exams/pdf/progress.bar.tsx
Normal file
@@ -0,0 +1,51 @@
|
||||
import React from "react";
|
||||
import { View, StyleSheet } from "@react-pdf/renderer";
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
progressBar: {
|
||||
borderRadius: 16,
|
||||
overflow: "hidden",
|
||||
},
|
||||
progressBarPerc: {
|
||||
height: "100%",
|
||||
zIndex: 1,
|
||||
},
|
||||
});
|
||||
|
||||
interface Props {
|
||||
width: number;
|
||||
height: number;
|
||||
backgroundColor: string;
|
||||
progressColor: string;
|
||||
percentage: number;
|
||||
}
|
||||
|
||||
const ProgressBar = ({
|
||||
width,
|
||||
height,
|
||||
backgroundColor,
|
||||
progressColor,
|
||||
percentage,
|
||||
}: Props) => {
|
||||
return (
|
||||
<View
|
||||
style={[
|
||||
{
|
||||
width,
|
||||
height,
|
||||
backgroundColor,
|
||||
},
|
||||
styles.progressBar,
|
||||
]}
|
||||
>
|
||||
<View
|
||||
style={[
|
||||
{ width: `${percentage}px`, backgroundColor: progressColor },
|
||||
styles.progressBarPerc,
|
||||
]}
|
||||
></View>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
|
||||
export default ProgressBar;
|
||||
Reference in New Issue
Block a user