simpler init script for tools
This commit is contained in:
parent
d8769b2d9d
commit
303d2dfc72
|
|
@ -1,6 +1,6 @@
|
|||
import { Hype } from '@because/hype'
|
||||
import { define, stylesToCSS } from '@because/forge'
|
||||
import { baseStyles, initScript, theme } from '@because/toes/tools'
|
||||
import { baseStyles, ToolScript, theme } from '@because/toes/tools'
|
||||
import { readdir, stat } from 'fs/promises'
|
||||
import { readFileSync } from 'fs'
|
||||
import { join, extname, basename } from 'path'
|
||||
|
|
@ -309,7 +309,7 @@ function Layout({ title, children, highlight, editable }: LayoutProps) {
|
|||
</head>
|
||||
<body>
|
||||
<script dangerouslySetInnerHTML={{ __html: fileMemoryScript }} />
|
||||
<script dangerouslySetInnerHTML={{ __html: initScript }} />
|
||||
<ToolScript />
|
||||
<Container>
|
||||
{children}
|
||||
</Container>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Hype } from '@because/hype'
|
||||
import { define, stylesToCSS } from '@because/forge'
|
||||
import { baseStyles, initScript, theme } from '@because/toes/tools'
|
||||
import { baseStyles, ToolScript, theme } from '@because/toes/tools'
|
||||
import { discoverCronJobs } from './lib/discovery'
|
||||
import { scheduleJob, stopJob } from './lib/scheduler'
|
||||
import { executeJob } from './lib/executor'
|
||||
|
|
@ -183,7 +183,7 @@ function Layout({ title, children }: { title: string; children: Child }) {
|
|||
<link rel="stylesheet" href="/styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script dangerouslySetInnerHTML={{ __html: initScript }} />
|
||||
<ToolScript />
|
||||
<Container>
|
||||
{children}
|
||||
</Container>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,2 @@
|
|||
export { theme } from '../client/themes'
|
||||
export { baseStyles, initScript } from './scripts'
|
||||
export { define, stylesToCSS } from '@because/forge'
|
||||
export { baseStyles, ToolScript } from './scripts.tsx'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { theme } from '../client/themes'
|
||||
|
||||
export const initScript = `
|
||||
const initScript = `
|
||||
(function() {
|
||||
var theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
document.body.setAttribute('data-theme', theme);
|
||||
|
|
@ -29,3 +29,5 @@ body {
|
|||
margin: 0;
|
||||
}
|
||||
`
|
||||
|
||||
export const ToolScript = () => <script dangerouslySetInnerHTML={{ __html: initScript }} />
|
||||
Loading…
Reference in New Issue
Block a user