import * as React from 'react';
import { ServiceData, VCardData, ServiceDataTypes } from './getServiceData';
function getLinkHref(url: string) {
return url.includes('@') ? `mailto:${url}` : url;
}
const VCard = ({ data }: { data: VCardData }) => {
if (!data.name && !data.address) {
return null;
}
return (
{data.name &&
{data.name}
}
{data.address &&
{data.address}
}
);
};
const List = ({ items }: { items: string[] }) => {
return (
{items.map((item, index) => (
- {`- ${item}`}
))}
);
};
const ExternalLink = ({ href, children }: React.PropsWithChildren<{ href: string }>) => {
return (
{children}
);
};
const LinkSection = ({ url, children }: React.PropsWithChildren<{ url: string }>) => {
return (
);
};
const SwitchContent = ({ content }: { content: ServiceData }) => {
switch (content.componentType) {
case 'v-card':
return ;
case 'list':
return
;
case 'text-link':
return {content.data};
default:
return {content.data}
;
}
};
export const SectionWithTitle = ({
title,
description,
children,
}: React.PropsWithChildren<{ title: string; description?: string }>): JSX.Element => {
return (
{title}
{description &&
{description}
}
{children}
);
};
export const ContentSection = ({ content }: { content: ServiceData }): JSX.Element => {
if (!content.data) {
return <>>;
}
if (content.componentType === 'link') {
return {content.title};
}
return (
);
};