Skip to content

Commit

Permalink
Merge pull request #2 from 0c370t/Tile-Component
Browse files Browse the repository at this point in the history
Add Tile Component

Resolves #1
  • Loading branch information
ItsMeBrianD authored Jul 26, 2020
2 parents 94de0e0 + 8c8e2a1 commit 08ab5e3
Show file tree
Hide file tree
Showing 23 changed files with 1,398 additions and 175 deletions.
714 changes: 635 additions & 79 deletions dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.min.js

Large diffs are not rendered by default.

707 changes: 627 additions & 80 deletions dist/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
}</style><style>#root[hidden],
#docs-root[hidden] {
display: none !important;
}</style></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><pre id="error-message" class="sb-heading"></pre><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><div id="docs-root"></div><script src="runtime~main.5a1dd4f5289c13896dcd.bundle.js"></script><script src="vendors~main.5a1dd4f5289c13896dcd.bundle.js"></script><script src="main.5a1dd4f5289c13896dcd.bundle.js"></script></body></html>
}</style></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><pre id="error-message" class="sb-heading"></pre><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><div id="docs-root"></div><script src="runtime~main.65c3451b62b39297fb37.bundle.js"></script><script src="vendors~main.65c3451b62b39297fb37.bundle.js"></script><script src="main.65c3451b62b39297fb37.bundle.js"></script></body></html>
2 changes: 0 additions & 2 deletions docs/main.5a1dd4f5289c13896dcd.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/main.5a1dd4f5289c13896dcd.bundle.js.map

This file was deleted.

2 changes: 2 additions & 0 deletions docs/main.65c3451b62b39297fb37.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/main.65c3451b62b39297fb37.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion docs/runtime~main.5a1dd4f5289c13896dcd.bundle.js.map

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/runtime~main.65c3451b62b39297fb37.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions docs/vendors~main.5a1dd4f5289c13896dcd.bundle.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/vendors~main.5a1dd4f5289c13896dcd.bundle.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions docs/vendors~main.65c3451b62b39297fb37.bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/vendors~main.65c3451b62b39297fb37.bundle.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 36 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
- [Drop](Drop#drop)
- [Dropdown](Dropdown#dropdown)
- [Flex](Flex#flex)
- [Tile](Tile#tile)
- [Width](helpers#width)
28 changes: 28 additions & 0 deletions src/Tile/README.md
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>
```
28 changes: 28 additions & 0 deletions src/Tile/Tile.svelte
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>
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ export {default as Flex, flexOptions} from "./Flex/Flex.svelte";

export {default as Inline} from "./Utility/Inline.svelte";

export {default as Tile, tileOptions} from "./Tile/Tile.svelte";

export {uk_width} from "./helpers/width";
export {uk_animate} from "./helpers/animation";
21 changes: 21 additions & 0 deletions stories/Tile.stories.js
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], "")
},

}
});
8 changes: 8 additions & 0 deletions stories/views/Tile/TileView.svelte
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>

0 comments on commit 08ab5e3

Please sign in to comment.