-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Add Tile Component Resolves #1
- Loading branch information
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
This file was deleted.
This file was deleted.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Tile | ||
> [UIKit documentation](https://getuikit.com/docs/tile) | ||
> [Storybook](https://0c370t.github.io/Svelte-UIKit3/docs/?path=/story/Tile--main) | ||
## Usage | ||
|
||
#### Props | ||
| name | type | description | see also | | ||
|-------------|-------|------------------------------|-------------------------------------------------| | ||
| style | enum | Background / Text color | Module context of [Tile.svelte](./Tile.svelte) | | ||
| width | enum | Width of the tile | [helpers/width.js](../helpers/) | | ||
|
||
#### Slots | ||
| name | type | inside | description | | ||
|---------|------|------------------------|-------------------------------------------| | ||
| default | any | root element (div) | Content of the tile | | ||
|
||
#### Real Example | ||
> Note that all props are default values | ||
```html | ||
<script> | ||
import {Tile} from 'svelte-uikit3'; | ||
</script> | ||
|
||
<Tile style={""} width={""}> | ||
<h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</h3> | ||
</Tile> | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<script context="module"> | ||
const styles = ["default", "muted", "primary", "secondary"] | ||
export const tileOptions = { | ||
styles | ||
} | ||
</script> | ||
|
||
<script> | ||
import {uk_width} from ".."; | ||
let classes = ["uk-tile"] | ||
export let style = ""; | ||
if(styles.includes(style.toLowerCase())){ | ||
classes.push("uk-tile-" + style.toLowerCase()) | ||
} else { | ||
classes.push("uk-tile-default") | ||
} | ||
export let width = ""; | ||
let _class = ""; | ||
export {_class as class} | ||
</script> | ||
|
||
<div class={classes.join(" ") + " " + _class} use:uk_width={width}> | ||
<slot/> | ||
</div> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import TileView from "./views/Tile/TileView.svelte"; | ||
import {withKnobs, text, boolean, number, select} from "@storybook/addon-knobs"; | ||
import {validWidths} from "../src/helpers/width"; | ||
import {tileOptions} from "../src"; | ||
|
||
export default { | ||
title: 'Tile', | ||
component: TileView, | ||
decorators: [withKnobs] | ||
}; | ||
|
||
export const Main = () => ({ | ||
Component: TileView, | ||
props: { | ||
props: { | ||
style: select("Style", [...tileOptions.styles], ""), | ||
width: select("Width", ["", ...validWidths], "") | ||
}, | ||
|
||
} | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<script> | ||
import {Tile} from "../../../src"; | ||
export let props = {}; | ||
</script> | ||
|
||
<Tile {...props}> | ||
<h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</h3> | ||
</Tile> |