diff --git a/src/context/color.ts b/src/context/color.ts new file mode 100644 index 0000000..ea1889e --- /dev/null +++ b/src/context/color.ts @@ -0,0 +1,6 @@ +import { atom } from 'recoil'; + +export const selectedColorIdState = atom({ + key: 'selectedColorIdState', + default: 0, +}); diff --git a/src/context/font.ts b/src/context/font.ts new file mode 100644 index 0000000..a3268a2 --- /dev/null +++ b/src/context/font.ts @@ -0,0 +1,6 @@ +import { atom } from 'recoil'; + +export const selectedFontIdState = atom({ + key: 'selectedFontIdState', + default: 0, +}); diff --git a/src/hooks/useCustomData.ts b/src/hooks/useCustomData.ts new file mode 100644 index 0000000..e595613 --- /dev/null +++ b/src/hooks/useCustomData.ts @@ -0,0 +1,41 @@ +import { Accessory } from '@api/accessory'; +import { AccessoryData } from '@api/accessory.types'; +import { Color } from '@api/color'; +import { ColorData } from '@api/color.types'; +import { Font } from '@api/font'; +import { FontData } from '@api/font.types'; +import { Pattern } from '@api/pattern'; +import { PatternData } from '@api/pattern.types'; +import { Wheel } from '@api/wheel'; +import { WheelData } from '@api/wheel.types'; +import { useEffect, useState } from 'react'; + +function useCustomData() { + const [pattern, setPattern] = useState([]); + const [wheel, setWheel] = useState([]); + const [font, setFont] = useState([]); + const [color, setColor] = useState([]); + const [accessory, setAccessory] = useState([]); + + useEffect(() => { + const getData = async () => { + const [patterns, wheels, fonts, colors, accessories] = await Promise.all([ + Pattern.list(), + Wheel.list(), + Font.list(), + Color.list(), + Accessory.list(), + ]); + setPattern(patterns); + setWheel(wheels); + setFont(fonts); + setColor(colors); + setAccessory(accessories); + }; + getData(); + }, []); + + return { pattern, wheel, font, color, accessory }; +} + +export default useCustomData; diff --git a/src/pages/production/button-group/index.style.tsx b/src/pages/production/button-group/index.style.tsx index 27b8a66..6cafe4b 100644 --- a/src/pages/production/button-group/index.style.tsx +++ b/src/pages/production/button-group/index.style.tsx @@ -1,6 +1,10 @@ import styled from 'styled-components'; -export const Container = styled.div` +interface ContainerProps { + position?: 'default' | 'absolute'; +} + +export const Container = styled.div` background-color: #cdd1d9; width: 100%; height: 100%; @@ -8,4 +12,8 @@ export const Container = styled.div` justify-content: center; align-items: center; gap: 5px; + + ${({ position }) => + position === 'absolute' && + 'position: absolute; bottom: 0; right: 0; height: 50px; background-color: #ffffff; width: 22%; margin: 30px;'} `; diff --git a/src/pages/production/button-group/index.tsx b/src/pages/production/button-group/index.tsx index c0a0526..209ee20 100644 --- a/src/pages/production/button-group/index.tsx +++ b/src/pages/production/button-group/index.tsx @@ -4,13 +4,14 @@ import { useNavigate } from 'react-router'; interface ButtonGroupProps { step: number; + position?: 'default' | 'absolute'; } function ButtonGroup(props: ButtonGroupProps) { const navigate = useNavigate(); return ( - + {props.step > 0 ? (