Skip to content

Commit

Permalink
fix: collapsable attribute on tree
Browse files Browse the repository at this point in the history
  • Loading branch information
KovaCro committed Jan 1, 2024
1 parent d05c6c7 commit eada664
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/docs/tree.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| **Name** | **Required** | **Type** | **Description** |
| :----: | :----: | :----: | :---: |
| title | |`string` | Title of the tree |
| collapsable | | `boolean` | collapse enabled |

### Slots

Expand Down
9 changes: 7 additions & 2 deletions packages/lib/src/tree/tree.wc.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

<script lang="ts">
export let title = 'Tree Title';
let expanded = false;
export let collapsable = true;
let expanded = !collapsable;
</script>

<svelte:document
Expand All @@ -27,7 +28,11 @@

<div class="jp-tree">
<div class="tree-header">
<button class="tree-arrow" on:click={() => (expanded = !expanded)}>
<button
class="tree-arrow"
on:click={() => expanded = !expanded}
disabled={!collapsable}
>
<svg
xmlns="http://www.w3.org/2000/svg"
height="1em"
Expand Down

0 comments on commit eada664

Please sign in to comment.