print firecons

main
Yanick Champoux 2022-03-26 13:55:12 -04:00
parent 3e63ea24dd
commit 0d3c053705
3 changed files with 27 additions and 2 deletions

View File

@ -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>

View File

@ -1,11 +1,11 @@
<div>
{#each _.range(firecons) as firecon}
{#each range(1,firecons) as firecon}
<img class="firecon" src="icons/firecon.svg" alt="firecon" />
{/each}
</div>
<script>
import _ from "lodash";
import {range} from "$lib/utils.js";
export let firecons = 0;
</script>

8
src/lib/utils.js Normal file
View 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);
}