docs: build carbon themes using sass

This commit is contained in:
Eric Liu 2020-07-23 19:58:54 -07:00
commit e2c8ea6d76
10 changed files with 808 additions and 28 deletions

View file

@ -7,8 +7,9 @@
HeaderNav,
HeaderNavItem,
HeaderUtilities,
HeaderActionLink
HeaderActionLink,
} from "carbon-components-svelte";
import Theme from "./Theme.svelte";
</script>
<Header

View file

@ -0,0 +1,29 @@
<script>
import { onMount } from "svelte";
import { Select, SelectItem } from "carbon-components-svelte";
let theme = undefined;
onMount(() => {
theme = localStorage.getItem("theme") || "g10";
});
$: if (theme) {
localStorage.setItem("theme", theme);
document.documentElement.setAttribute("carbon-theme", theme);
}
</script>
<style>
:global(.bx--select-input) {
width: auto;
min-width: 0;
}
</style>
<Select inline labelText="Theme" bind:selected={theme}>
<SelectItem value="white" text="White" />
<SelectItem value="g10" text="Gray 10" />
<SelectItem value="g90" text="Gray 90" />
<SelectItem value="g100" text="Gray 100" />
</Select>

View file

@ -29,6 +29,10 @@
</script>
<style>
:global(#sapper) {
min-height: 100vh;
}
:global(.bx--content) {
padding: 0;
}

View file

@ -1,10 +1,7 @@
<script>
import components from "./components/_components";
import { Link } from "carbon-components-svelte";
import Theme from "../components/Theme.svelte";
</script>
<h1>Welcome</h1>
{#each components as component}
<Link href="examples/{component.title}">{component.title}</Link>
{/each}
<Theme />

View file

@ -9,10 +9,7 @@
<link rel="manifest" href="manifest.json" crossorigin="use-credentials" />
<link rel="icon" type="image/png" href="favicon.png" />
<link
rel="stylesheet"
href="https://unpkg.com/carbon-components/css/carbon-components.min.css"
/>
<link rel="stylesheet" href="style.css" />
<title>Carbon Components Svelte</title>
%sapper.styles% %sapper.head%