aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-09-11 16:28:47 +0100
committerGravatar Joe Banks <[email protected]>2024-09-11 16:28:47 +0100
commit239590ae5db74eea4b8efc95862c562ded2bfc0a (patch)
tree1e86bfb4c0b843da0fba24e4089f773b19f45f24
parentAdd some overrides for toast notifications (diff)
Add component to display voucher metadata at store page
-rw-r--r--thallium-frontend/src/components/Voucher.tsx33
1 files changed, 33 insertions, 0 deletions
diff --git a/thallium-frontend/src/components/Voucher.tsx b/thallium-frontend/src/components/Voucher.tsx
new file mode 100644
index 0000000..bf22724
--- /dev/null
+++ b/thallium-frontend/src/components/Voucher.tsx
@@ -0,0 +1,33 @@
+import { Voucher as VoucherType } from "../api/vouchers";
+import styled from "styled-components";
+
+interface VoucherProps {
+ voucher: VoucherType;
+}
+
+const VoucherContainer = styled.div`
+background: linear-gradient(45deg, ${(props) => props.theme.accent}99 0%, ${(props) => props.theme.accent}ff 100%);
+color: white;
+padding: 1.5rem;
+margin-top: 1rem;
+padding-left: 4rem;
+padding-right: 4rem;
+/* zig-zag mask */
+--mask:
+ conic-gradient(from 45deg at left, #0000,#000 1deg 89deg,#0000 90deg) left /51% 15px repeat-y,
+ conic-gradient(from -135deg at right, #0000,#000 1deg 89deg,#0000 90deg) right/51% 15px repeat-y;
+
+-webkit-mask: var(--mask);
+mask: var(--mask);
+`;
+
+const Voucher: React.FC<VoucherProps> = ({ voucher }: VoucherProps) => {
+ return (
+ <VoucherContainer>
+ <p><strong>Voucher:</strong> {voucher.voucher_code}<br />
+ <strong>Balance:</strong> ${voucher.balance} USD</p>
+ </VoucherContainer>
+ );
+};
+
+export default Voucher;