Skip to content

Commit

Permalink
feat: store info about expand settings block in store
Browse files Browse the repository at this point in the history
  • Loading branch information
istudyatuni committed Apr 22, 2022
1 parent ddc70a1 commit cc69764
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
import Button from 'src/components/atoms/Button.svelte'
import InputNumber from 'src/components/atoms/InputNumber.svelte'
import { draw as drawStore } from 'src/stores/settings'
import { draw as drawStore, settings } from 'src/stores/settings'
import { refresh } from 'src/stores/refresh'
</script>

<script>
let show = true
function toggleShow() {
show = !show
settings.set('show_settings', !$settings.show_settings)
}
function should_refresh() {
refresh.set(true)
Expand All @@ -23,8 +21,10 @@
}
</script>

<div class="absolute rounded bg-gray-200 m-5 select-none" class:p-2={show}>
{#if show}
<div
class="absolute rounded bg-gray-200 m-5 select-none"
class:p-2={$settings.show_settings}>
{#if $settings.show_settings}
<div class="flex justify-between mb-3">
<Button on:click={toggleShow} class="mr-2">Hide</Button>
<Button on:click={() => window.location.reload()} disabled={!$refresh}>
Expand Down
4 changes: 4 additions & 0 deletions src/stores/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ export const draw = sessionStore('draw-settings', {
rx: 1,
yc: 0,
})

export const settings = sessionStore('settings', {
show_settings: true,
})

0 comments on commit cc69764

Please sign in to comment.