Adds nav component, intrgrates about page, improved error handling, removed unused features

This commit is contained in:
Alicia Sykes
2023-07-08 16:59:48 +01:00
parent efd528f198
commit cdca4b0058
11 changed files with 139 additions and 63 deletions

View File

@@ -1,6 +1,6 @@
import { Card } from 'components/Form/Card';
import colors from 'styles/colors';
import Row, { ListRow } from 'components/Form/Row';
import Row from 'components/Form/Row';
import Heading from 'components/Form/Heading';
const styles = `
@@ -17,7 +17,12 @@ const styles = `
`;
const formatDate = (timestamp: number): string => {
if (isNaN(timestamp) || timestamp <= 0) return 'No Date';
const date = new Date(timestamp * 1000);
if (isNaN(date.getTime())) return 'Unknown';
const formatter = new Intl.DateTimeFormat('en-GB', {
day: 'numeric',
month: 'long',
@@ -26,16 +31,18 @@ const formatDate = (timestamp: number): string => {
minute: '2-digit',
hour12: true
});
return formatter.format(date);
}
const SiteFeaturesCard = (props: { data: any, title: string, actionButtons: any }): JSX.Element => {
const features = props.data;
return (
<Card heading={props.title} actionButtons={props.actionButtons} styles={styles}>
<div className="content">
{ features.groups.filter((group: any) => group.categories.length > 0).map((group: any, index: number) => (
{ (features?.groups || []).filter((group: any) => group.categories.length > 0).map((group: any, index: number) => (
<div key={`${group.name}-${index}`}>
<Heading as="h4" size="small" color={colors.primary}>{group.name}</Heading>
{ group.categories.map((category: any, subIndex: number) => (