Added usage of MobileCard type on Service page

This commit is contained in:
Neshura 2022-12-23 18:41:10 +01:00
parent b9540478e5
commit ce0a7c43c0
No known key found for this signature in database
GPG key ID: ACDF5B6EBECF6B0A

View file

@ -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 = <div>Error loading data</div> }
else if (loadingFull) {
content =
<PageContentBox>
{initialData?.map((item: Service) => (
<CardContentService key={item.name} content={item} />
))}
</PageContentBox>
if (isMobile) {
content =
<PageContentBox>
{initialData?.map((item: Service) => (
<ServiceCardMobile key={item.name} content={item} />
))}
</PageContentBox>
}
else {
content =
<PageContentBox>
{initialData?.map((item: Service) => (
<CardContentService key={item.name} content={item} />
))}
</PageContentBox>
}
}
else if (fullData) {
content =
<PageContentBox>
{fullData.map((item: Service) => (
<CardContentService key={item.name} content={item} />
))}
</PageContentBox>
if (isMobile) {
content =
<PageContentBox>
{fullData.map((item: Service) => (
<ServiceCardMobile key={item.name} content={item} />
))}
</PageContentBox>
}
else {
content =
<PageContentBox>
{fullData.map((item: Service) => (
<CardContentService key={item.name} content={item} />
))}
</PageContentBox>
}
}
else {
content = <div>Error loading data</div>