mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
38 lines
992 B
JavaScript
38 lines
992 B
JavaScript
import * as React from "react";
|
|
import Head from "next/head";
|
|
import dynamic from "next/dynamic";
|
|
import Meta from "~/components/Meta";
|
|
import Loading from "~/components/Loading";
|
|
const LookingGlass = dynamic(() => import("~/components/LookingGlass"), {
|
|
loading: Loading
|
|
});
|
|
|
|
const Index = ({ faviconComponents }) => {
|
|
return (
|
|
<>
|
|
<Head>
|
|
{faviconComponents.map(({ rel, href, type }, i) => (
|
|
<link rel={rel} href={href} type={type} key={i} />
|
|
))}
|
|
</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}` };
|
|
});
|
|
return {
|
|
props: {
|
|
faviconComponents: components
|
|
}
|
|
};
|
|
}
|
|
|
|
export default Index;
|