print firecons
This commit is contained in:
parent
3e63ea24dd
commit
0d3c053705
@ -0,0 +1,17 @@
|
|||||||
|
<Meta title="Output/Print/Systems/Firecons" component={Firecons} argTypes={{
|
||||||
|
firecons: { defaultValue: 2, type: 'number' }
|
||||||
|
}} />
|
||||||
|
|
||||||
|
<Story name="Primary" args={{}} />
|
||||||
|
|
||||||
|
<Template let:args>
|
||||||
|
<div style="width: 50em">
|
||||||
|
<Firecons {...args}/>
|
||||||
|
</div>
|
||||||
|
</Template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { Meta, Template, Story } from "@storybook/addon-svelte-csf";
|
||||||
|
|
||||||
|
import Firecons from './index.svelte';
|
||||||
|
</script>
|
@ -1,11 +1,11 @@
|
|||||||
<div>
|
<div>
|
||||||
{#each _.range(firecons) as firecon}
|
{#each range(1,firecons) as firecon}
|
||||||
<img class="firecon" src="icons/firecon.svg" alt="firecon" />
|
<img class="firecon" src="icons/firecon.svg" alt="firecon" />
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import _ from "lodash";
|
import {range} from "$lib/utils.js";
|
||||||
|
|
||||||
export let firecons = 0;
|
export let firecons = 0;
|
||||||
</script>
|
</script>
|
||||||
|
8
src/lib/utils.js
Normal file
8
src/lib/utils.js
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
export function range(min, max) {
|
||||||
|
if(max === undefined) {
|
||||||
|
max = min;
|
||||||
|
min = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Array.from({length: 1+max - min}).map( (_d,i) => i+ min);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user