From ce0a7c43c0ee3a3f1c24cada318e489f86c21833 Mon Sep 17 00:00:00 2001 From: Neshura Date: Fri, 23 Dec 2022 18:41:10 +0100 Subject: [PATCH] Added usage of MobileCard type on Service page --- pages/services.tsx | 47 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/pages/services.tsx b/pages/services.tsx index 9a24a5a..25436b5 100644 --- a/pages/services.tsx +++ b/pages/services.tsx @@ -4,31 +4,54 @@ import Dockerode from 'dockerode'; import { ReactElement } from 'react' import useSWR from 'swr'; import { CardContentService, PageContentBox, PageDescription, PageTitle } from '../components/styles/content'; +import { ServiceCardMobile } from '../components/styles/cards/mobile'; import ServiceList from '../public/pages.json'; +import useWindowSize from '../components/windowsize'; const fetcher = (url: string) => fetch(url).then((res) => res.json()) function Services() { const { initialData, fullData, loadingFull, error } = useServices(); + const isMobile = useWindowSize(); let content: ReactElement = <>; if (error) { content =
Error loading data
} else if (loadingFull) { - content = - - {initialData?.map((item: Service) => ( - - ))} - + if (isMobile) { + content = + + {initialData?.map((item: Service) => ( + + ))} + + } + else { + content = + + {initialData?.map((item: Service) => ( + + ))} + + } } else if (fullData) { - content = - - {fullData.map((item: Service) => ( - - ))} - + if (isMobile) { + content = + + {fullData.map((item: Service) => ( + + ))} + + } + else { + content = + + {fullData.map((item: Service) => ( + + ))} + + } } else { content =
Error loading data