From 5ba48995992cb6e3c144957dff67186a87bdbbc4 Mon Sep 17 00:00:00 2001 From: Everton Correia <1169768+evertonstz@users.noreply.github.com> Date: Thu, 21 Mar 2024 16:46:13 -0300 Subject: [PATCH] Add parallax animation in device screen (#34) * initial commit --- .../AddDeviceFooter/AddDeviceFooter.tsx | 9 +- .../AddDeviceFooter/SerialInput.tsx | 14 +- .../PaxPairingSvg/ParallaxComponent.tsx | 151 ++++++++++++++++++ .../Graphics/PaxPairingSvg/PaxPairing.tsx | 61 ++++--- .../Graphics/PaxPairingSvg/PulsatingLight.tsx | 22 ++- .../PaxPairingSvg/Svg/Pax3DeviceSvg.tsx | 10 +- .../MainContent/NoSelectedDevice.tsx | 15 +- src/components/Modal/Modal.tsx | 10 +- src/hooks/index.ts | 1 + src/hooks/useIsMobile.tsx | 15 ++ 10 files changed, 259 insertions(+), 49 deletions(-) create mode 100644 src/components/Graphics/PaxPairingSvg/ParallaxComponent.tsx create mode 100644 src/hooks/useIsMobile.tsx diff --git a/src/components/AddDeviceFooter/AddDeviceFooter.tsx b/src/components/AddDeviceFooter/AddDeviceFooter.tsx index 9da87d9..8a77307 100644 --- a/src/components/AddDeviceFooter/AddDeviceFooter.tsx +++ b/src/components/AddDeviceFooter/AddDeviceFooter.tsx @@ -10,6 +10,11 @@ import SerialInput from './SerialInput'; const SERIAL_SIZE = 8; const INPUT_PLACEHOLDER = `Insert ${SERIAL_SIZE} digits serial`; +interface Props { + onFocus?: React.FocusEventHandler; + onBlur?: React.FocusEventHandler; +} + const buildOptions = (devices: Pax.lib.Devices[]) => { return devices.map(device => { return { value: device, label: device }; @@ -23,7 +28,7 @@ const addNewDeviceButtonDisabled = (serialInput: string | undefined) => { return false; }; -const AddDeviceFooter = () => { +const AddDeviceFooter = (props: Props) => { const defaultDevice = SUPPORTED_DEVICES[0]; const [serialInput, setSerialInput] = useState(undefined); const [deviceValue, setDeviceValue] = @@ -56,6 +61,8 @@ const AddDeviceFooter = () => { value={serialInput} onValueChange={setSerialInput} placeholder={INPUT_PLACEHOLDER} + onFocus={props.onFocus} + onBlur={props.onBlur} />