diff --git a/web/components/endpoint.tsx b/web/components/endpoint.tsx new file mode 100644 index 0000000..466d64a --- /dev/null +++ b/web/components/endpoint.tsx @@ -0,0 +1,45 @@ +import clsx from 'clsx' +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' +import Link from 'next/link' +import type { FunctionComponent } from 'react' +import type { IconProp } from '@fortawesome/fontawesome-svg-core' + +type Props = { + href: string + title: string + width?: number + height?: number + rowStart?: number + colStart?: number + className?: string + icon?: IconProp +} + +const Endpoint: FunctionComponent = ({ className, href, title, children, width, height, rowStart, colStart, icon }) => { + return ( + + + {icon && ( + + + + )} +

{title}

+

{children}

+
+ + ) +} + +export default Endpoint diff --git a/web/components/nav.tsx b/web/components/nav.tsx index 290d8a4..c117d74 100644 --- a/web/components/nav.tsx +++ b/web/components/nav.tsx @@ -10,7 +10,7 @@ const Nav: FunctionComponent = () => { DfE Attendance Scraper - Unofficial + Unofficial diff --git a/web/data/endpoints.json b/web/data/endpoints.json deleted file mode 100644 index c8df126..0000000 --- a/web/data/endpoints.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "endpoints": [ - { - "href": "/daily", - "title": "Daily Attendance", - "desc": "Daily attendance data for schools from Sep 2020 to present!" - } - ] -} \ No newline at end of file diff --git a/web/package.json b/web/package.json index 68af9e2..16b230f 100644 --- a/web/package.json +++ b/web/package.json @@ -11,6 +11,7 @@ "adm-zip": "^0.5.9", "axios": "^0.24.0", "cheerio": "^1.0.0-rc.10", + "clsx": "^1.1.1", "immer": "^9.0.7", "next": "12.0.7", "next-themes": "^0.0.15", diff --git a/web/pages/index.tsx b/web/pages/index.tsx index b34a097..ae16d48 100644 --- a/web/pages/index.tsx +++ b/web/pages/index.tsx @@ -1,52 +1,34 @@ -import type { GetStaticProps } from 'next' import type { FunctionComponent } from 'react' -import Link from 'next/link' import Nav from '@/c/nav' +import Endpoint from '@/c/endpoint' +import { faCalendarDay } from '@fortawesome/pro-solid-svg-icons' -export const getStaticProps: GetStaticProps = async () => { - const { endpoints } = await import('../data/endpoints.json') - - return { - props: { - endpoints, - }, - } -} - -type Props = { - endpoints: { - href: string - title: string - desc: string - }[] -} - -const Home: FunctionComponent & { title?: string } = ({ endpoints }) => { +const Home: FunctionComponent & { title?: string } = () => { return ( <>