diff --git a/src/components/AccentedAlert.tsx b/src/components/AccentedAlert.tsx new file mode 100644 index 0000000..f6d0154 --- /dev/null +++ b/src/components/AccentedAlert.tsx @@ -0,0 +1,48 @@ +import { ExclamationTriangleIcon } from '@heroicons/react/20/solid'; +import clsx from 'clsx'; +import { FunctionComponent } from 'react'; + +// type AccentColors = 'red' | 'yellow' | 'green'; +// type AccentColorClass = { base: string; text: string; hover: string }; + +type AccentedAlertProps = { + className?: string; + // color?: AccentColors; + text: string; +}; + +const AccentedAlert: FunctionComponent = ({ + className, + text +}) => { + return ( +
+
+
+
+
+

+ {text} + {/* */} + {/* Upgrade your account to add more credits. */} + {/* */} +

+
+
+
+ ); +}; + +export default AccentedAlert; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 41a595a..ee2eda9 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -10,9 +10,11 @@ import Layout from '@/components/Layout'; import ConfigurationList from '@/components/ConfigurationList'; import superjson from 'superjson'; import type { Configuration } from '@/timing'; +import AccentedAlert from '@/components/AccentedAlert'; type IndexPageProps = { json: string; + error?: string; }; export async function getServerSideProps({ @@ -26,7 +28,8 @@ export async function getServerSideProps({ const config = await fetchConfiguration({ times: [] }, true); return { props: { - json: superjson.stringify(config) + json: superjson.stringify(config), + error: 'NetworkError occurred while fetching resource.' } }; } @@ -39,10 +42,16 @@ export async function getServerSideProps({ }; } -const IndexPage: NextPage = ({ json }) => { +const IndexPage: NextPage = ({ error, json }) => { const config = superjson.parse(json); + const errorElement = + error != undefined ? ( + + ) : undefined; + return ( + {errorElement} );