1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
Files
checktheroads-hyperglass/hyperglass/ui/pages/index.js

38 lines
992 B
JavaScript
Raw Normal View History

import * as React from "react";
2020-06-21 14:11:23 -07:00
import Head from "next/head";
2020-01-21 20:02:50 -07:00
import dynamic from "next/dynamic";
2020-06-12 18:50:17 -07:00
import Meta from "~/components/Meta";
2020-01-21 20:02:50 -07:00
import Loading from "~/components/Loading";
const LookingGlass = dynamic(() => import("~/components/LookingGlass"), {
loading: Loading
});
2020-01-19 22:03:47 -07:00
2020-06-21 14:11:23 -07:00
const Index = ({ faviconComponents }) => {
return (
<>
<Head>
{faviconComponents.map(({ rel, href, type }, i) => (
<link rel={rel} href={href} type={type} key={i} />
))}
2020-06-21 14:11:23 -07:00
</Head>
<Meta />
<LookingGlass />
</>
);
};
export async function getStaticProps(context) {
const components = process.env._HYPERGLASS_FAVICONS_.map(icon => {
const { image_format, dimensions, prefix, rel } = icon;
const src = `/images/favicons/${prefix}-${dimensions[0]}x${dimensions[1]}.${image_format}`;
return { rel, href: src, type: `image/${image_format}` };
2020-06-21 14:11:23 -07:00
});
return {
props: {
faviconComponents: components
}
};
}
2020-01-17 02:50:57 -07:00
export default Index;