-
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
1 parent
341f896
commit 9a8a884
Showing
13 changed files
with
141 additions
and
14 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
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 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,14 @@ | ||
<script context="module"> | ||
export const context = 'THEME' | ||
</script> | ||
|
||
<script lang="ts"> | ||
import type { DefaultTheme } from '@teiler/core' | ||
import { setContext } from 'svelte' | ||
export let theme: DefaultTheme | ||
setContext<DefaultTheme>(context, theme) | ||
</script> | ||
|
||
<slot /> |
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,29 @@ | ||
<script lang="ts"> | ||
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"; | ||
import Theme from "./Theme.svelte"; | ||
</script> | ||
|
||
<Meta | ||
title="Svelte/Theme" | ||
component={Theme} | ||
argTypes={{ | ||
label: { control: "text" }, | ||
}} | ||
/> | ||
|
||
<Template let:args> | ||
<Theme {...args} on:click={args.onClick} /> | ||
</Template> | ||
|
||
<Story | ||
name="Default" | ||
/> | ||
|
||
<Story | ||
name="Provide options" | ||
args={{ | ||
theme: { | ||
fontColor: 'green', | ||
} | ||
}} | ||
/> |
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,17 @@ | ||
<script context="module" lang="ts"> | ||
export type CustomTheme = { | ||
fontColor: string, | ||
} | ||
</script> | ||
<script lang="ts"> | ||
import ThemeProvider from '../src/ThemeProvider.svelte' | ||
import { Component } from './theme' | ||
export let theme: CustomTheme = { | ||
fontColor: 'red', | ||
} | ||
</script> | ||
|
||
<ThemeProvider {theme}> | ||
<Component>Some test text</Component> | ||
</ThemeProvider> |
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,5 @@ | ||
import type { CustomTheme } from "./Theme.svelte"; | ||
|
||
declare module '@teiler/core' { | ||
export interface DefaultTheme extends CustomTheme {} | ||
} |
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,7 @@ | ||
import component from '@teiler/svelte' | ||
|
||
const Component = component.div` | ||
color: ${({ theme }) => theme.fontColor}; | ||
` | ||
|
||
export { Component } |
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,7 @@ | ||
{ | ||
"include": [ | ||
"src/**/*" | ||
"src/**/*", | ||
"stories/stories.d.ts" | ||
], | ||
"exclude": [ | ||
"node_modules" | ||
|