({Component, pageProps}: AppProps)
| 24 | } |
| 25 | |
| 26 | function MyApp({Component, pageProps}: AppProps) { |
| 27 | const [theme, setTheme] = useState<ColorScheme>('light'); |
| 28 | |
| 29 | let router = useRouter(); |
| 30 | let themeIcons = {dark: <Moon />, light: <Light />}; |
| 31 | let otherTheme: ColorScheme = theme === 'light' ? 'dark' : 'light'; |
| 32 | enableTableNestedRows(); |
| 33 | |
| 34 | return ( |
| 35 | <> |
| 36 | <Script id="font-loading"> |
| 37 | {`(function(d) { |
| 38 | var config = { |
| 39 | kitId: 'uei1lip', |
| 40 | scriptTimeout: 3000, |
| 41 | async: true |
| 42 | }, |
| 43 | h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s) |
| 44 | })(document);`} |
| 45 | </Script> |
| 46 | <Provider |
| 47 | theme={lightTheme} |
| 48 | colorScheme={theme} |
| 49 | router={{ |
| 50 | navigate: (href, opts) => router.push(href, undefined, opts), |
| 51 | useHref: (href: string) => router.basePath + href |
| 52 | }} |
| 53 | locale="en"> |
| 54 | <Grid |
| 55 | areas={['header', 'content']} |
| 56 | columns={['1fr']} |
| 57 | rows={['size-200', 'auto']} |
| 58 | gap="size-100"> |
| 59 | <Flex direction="row" gap="size-100" justifyContent="end" margin="size-100"> |
| 60 | <ActionButton |
| 61 | aria-label={`Switch to ${otherTheme} mode.`} |
| 62 | onPress={() => setTheme(otherTheme)}> |
| 63 | {themeIcons[otherTheme]} |
| 64 | </ActionButton> |
| 65 | </Flex> |
| 66 | <View> |
| 67 | <Component {...pageProps} /> |
| 68 | </View> |
| 69 | </Grid> |
| 70 | <ToastContainer /> |
| 71 | </Provider> |
| 72 | </> |
| 73 | ); |
| 74 | } |
| 75 | export default MyApp; |
nothing calls this directly
no test coverage detected