forked from tajo/ladle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
79 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
const currentTheme = localStorage.getItem("theme"); | ||
if (currentTheme == "dark") { | ||
document.documentElement.setAttribute("data-theme", "dark"); | ||
} else if (currentTheme == "light") { | ||
document.documentElement.setAttribute("data-theme", "light"); | ||
// @ts-ignore | ||
console.log(window.matchMedia("(prefers-color-scheme: dark)")); | ||
const buildTheme = import.meta.env.SNOWPACK_PUBLIC_LADLE_THEME; | ||
const currentTheme = localStorage.getItem("ladle_theme"); | ||
if (!currentTheme) { | ||
if (buildTheme === "auto") { | ||
if (window.matchMedia("(prefers-color-scheme: dark)").matches) { | ||
localStorage.setItem("ladle_theme", "dark"); | ||
document.documentElement.setAttribute("data-theme", "dark"); | ||
} else { | ||
localStorage.setItem("ladle_theme", "light"); | ||
document.documentElement.setAttribute("data-theme", "light"); | ||
} | ||
} else { | ||
localStorage.setItem("ladle_theme", buildTheme); | ||
document.documentElement.setAttribute("data-theme", buildTheme); | ||
} | ||
} else { | ||
document.documentElement.setAttribute("data-theme", currentTheme); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
import path from "path"; | ||
|
||
export const storyGlob = "src/**/*.stories.{js,jsx,ts,tsx}"; | ||
export const appSrcDir = path.join(process.cwd(), "dist/app/src"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env node | ||
|
||
import devBundler from "./dev-bundler"; | ||
import { DevParamsT } from "./types"; | ||
|
||
const serve = async (params: DevParamsT) => { | ||
process.env["SNOWPACK_PUBLIC_LADLE_THEME"] = params.theme; | ||
await devBundler(params); | ||
}; | ||
|
||
export default serve; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters