From dc92290dd09c26003f57f59eac59b9136a7f28e2 Mon Sep 17 00:00:00 2001 From: Joel Davies Date: Fri, 16 Aug 2024 13:16:35 +0000 Subject: [PATCH] DSEGOG-341 Update preloader --- src/api/records.tsx | 1 - .../preloader.component.test.tsx.snap | 13 +++---- src/preloader/preloader.component.tsx | 39 +++++++++---------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/api/records.tsx b/src/api/records.tsx index 23cc8123..0f833fba 100644 --- a/src/api/records.tsx +++ b/src/api/records.tsx @@ -230,7 +230,6 @@ export const fetchRangeRecordConverterQuery = ( if (shotnumMin || shotnumMax) { inputRange = { min: shotnumMin, max: shotnumMax }; } - console.log('RETURNING RESULT'); return { ...inputRange, ...response.data }; } }); diff --git a/src/preloader/__snapshots__/preloader.component.test.tsx.snap b/src/preloader/__snapshots__/preloader.component.test.tsx.snap index 001ba7c3..3aa78845 100644 --- a/src/preloader/__snapshots__/preloader.component.test.tsx.snap +++ b/src/preloader/__snapshots__/preloader.component.test.tsx.snap @@ -17,26 +17,25 @@ exports[`Preloader component > renders when the site is loading 1`] = ` class="MuiBox-root css-1axvgr5" >
diff --git a/src/preloader/preloader.component.tsx b/src/preloader/preloader.component.tsx index 9d5f324b..5e87902c 100644 --- a/src/preloader/preloader.component.tsx +++ b/src/preloader/preloader.component.tsx @@ -1,4 +1,4 @@ -import { Box } from '@mui/material'; +import { Box, keyframes, styled } from '@mui/material'; import React from 'react'; const colors = ['#8C4799', '#1D4F91', '#C34613', '#008275', '#63666A']; @@ -11,11 +11,13 @@ interface PreloaderProps { children: React.ReactNode; } -interface SpinnerStyle { - [id: string]: string | number; -} +const rotate = keyframes` + to { + transform: rotateZ(360deg); + } +`; -const spinnerStyle = (index: number): SpinnerStyle => { +const StyledI = styled('i')(({ index }: { index: number }) => { const size = innerRadius + index * 2 * (border + spacing); return { @@ -32,7 +34,7 @@ const spinnerStyle = (index: number): SpinnerStyle => { width: size, marginTop: -size / 2, marginLeft: -size / 2, - animationName: 'rotate', + animationName: `${rotate}`, animationIterationCount: 'infinite', animationDuration: '3s', animationTimingFunction: `cubic-bezier(.09, ${0.3 * index}, ${ @@ -41,7 +43,7 @@ const spinnerStyle = (index: number): SpinnerStyle => { transformOrigin: '50% 100% 0', boxSizing: 'border-box', }; -}; +}); const Preloader: React.FC = (props: PreloaderProps) => (
@@ -58,25 +60,22 @@ const Preloader: React.FC = (props: PreloaderProps) => ( justifyContent: 'center', }} > -
-
+ - - - - - -
+ + + + + +
Loading...