Skip to content

Add ThumbNav Component #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
- [Dropdown](Dropdown#dropdown)
- [Flex](Flex#flex)
- [List](List#list)
- [ThumbNav](ThumbNav#thumbnav)
- [Tile](Tile#tile)
- [Width](helpers#width)
19 changes: 19 additions & 0 deletions src/ThumbNav/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# ⚠️ This Section is a WIP ⚠️


# ThumbNav
> [UIKit documentation](https://getuikit.com/docs/thumbnav)

> [Storybook](https://0c370t.github.io/Svelte-UIKit3/docs/?path=/story/Thumbnav--main)
## Usage

#### Props
| name | type | description | see also |
|-------------|-------|------------------------------|---------------------------------|

#### Slots
| name | type | inside | description |
|---------|------|------------------------|-------------------------------------------|

#### Real Example
> Note that all props are default values
30 changes: 30 additions & 0 deletions src/ThumbNav/ThumbNav.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script context="module">

</script>

<script>
import {uk_width} from "..";

export let vertical = false;
export let width;

let classes = ["uk-thumbnav"];

$: {
classes = ["uk-thumbnav"];

if (vertical) {
classes.push("uk-thumbnav-vertical")
}

classes = classes

}

let _class = "";
export {_class as class}
</script>

<ul class={classes.join(" ") + " " + _class} use:uk_width={width}>
<slot/>
</ul>
12 changes: 12 additions & 0 deletions src/ThumbNav/ThumbNavItem.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script>
export let href = "#";
export let src = "";
export let alt = "";
export let width = "";
</script>

<li>
<a {href}>
<img {src} {alt} {width}/>
</a>
</li>
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export {default as Inline} from "./Utility/Inline.svelte";

export {default as List, listOptions} from "./List/List.svelte";

export {default as ThumbNav} from "./ThumbNav/ThumbNav.svelte";
export {default as ThumbNavItem} from "./ThumbNav/ThumbNavItem.svelte";

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

export {uk_width} from "./helpers/width";
Expand Down
20 changes: 20 additions & 0 deletions stories/ThumbNav.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import ThumbnavView from "./views/ThumbNav/ThumbnavView.svelte";
import {thumbnavOptions} from "../src";
import {withKnobs, text, boolean, number, select} from "@storybook/addon-knobs";
import {validWidths} from "../src/helpers/width";

export default {
title: 'ThumbNav',
component: ThumbnavView,
decorators: [withKnobs]
};

export const Main = () => ({
Component: ThumbnavView,
props: {
props: {
vertical: boolean("Vertical", false),
width: select("Width", ["", ...validWidths], "")
},
}
});
11 changes: 11 additions & 0 deletions stories/views/ThumbNav/ThumbnavView.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<script>
import {ThumbNav, ThumbNavItem} from "../../../src"
export let props = {}

</script>

<ThumbNav {...props}>
<ThumbNavItem alt="a bear" src="https://placebear.com/400/300" width="100"/>
<ThumbNavItem alt="a bear" src="https://placebear.com/400/300" width="100"/>
<ThumbNavItem alt="a bear" src="https://placebear.com/400/300" width="100"/>
</ThumbNav>