-
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
594d3ef
commit 265d2ab
Showing
3 changed files
with
46 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script lang="ts"> | ||
import { Meta, Template, Story } from "@storybook/addon-svelte-csf"; | ||
import ComponentSelector from "./ComponentSelector.svelte"; | ||
</script> | ||
|
||
<Meta | ||
title="Svelte/ComponentSelector" | ||
component={ComponentSelector} | ||
argTypes={{ | ||
label: { control: "text" }, | ||
}} | ||
/> | ||
|
||
<Template let:args> | ||
<ComponentSelector {...args} on:click={args.onClick} /> | ||
</Template> | ||
|
||
<Story | ||
name="Default" | ||
/> |
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 @@ | ||
|
||
<script lang="ts"> | ||
import { Component, InnerComponent } from './componentSelector' | ||
</script> | ||
|
||
<Component>Default component</Component> | ||
<InnerComponent><Component>Same component with color override</Component></InnerComponent> |
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,19 @@ | ||
import { component } from '@teiler/svelte' | ||
|
||
const Component = component.div` | ||
color: black; | ||
background: #efefef; | ||
border-radius: 5px; | ||
padding: 10px 12px; | ||
display: inline-block; | ||
` | ||
|
||
const InnerComponent = component` | ||
display: inline-block; | ||
& ${Component} { | ||
color: red !important; | ||
} | ||
` | ||
|
||
export { Component, InnerComponent } |