diff --git a/src/components/RightPanel/ColorsSection.tsx b/src/components/RightPanel/ColorsSection.tsx new file mode 100644 index 0000000..e3e1a01 --- /dev/null +++ b/src/components/RightPanel/ColorsSection.tsx @@ -0,0 +1,73 @@ +import { useRef } from 'react'; +import { useQR } from '../../context/QRContext'; +import { ColorSwatch } from '../ui/ColorSwatch'; +import { QR_COLORS, BG_COLORS } from '../../config/styleOptions'; + +export function ColorsSection() { + const { state, dispatch } = useQR(); + const qrPickerRef = useRef(null); + const bgPickerRef = useRef(null); + + return ( +
+

Colors

+ +
+ QR Code +
+ {QR_COLORS.map(color => ( + dispatch({ type: 'SET_QR_COLOR', payload: color })} /> + ))} + {/* Custom picker */} + +
+ {!QR_COLORS.includes(state.qrColor) && ( +
+
+ {state.qrColor} +
+ )} +
+ +
+ Background +
+ {BG_COLORS.map((color, i) => ( + dispatch({ type: 'SET_BG_COLOR', payload: color })} /> + ))} + {/* Custom bg picker */} + +
+
+
+ ); +}