From eb9e7c02fc30b1b396c2dc07a34f700f8a4b4039 Mon Sep 17 00:00:00 2001 From: Conor Mack Date: Mon, 2 Mar 2020 14:43:06 +0000 Subject: [PATCH] Completed menu component --- .../src/List/List.svelte | 29 +++++++------------ .../src/List/ListItem.svelte | 6 ++-- .../src/Menu/Menu.svelte | 27 +++++++---------- .../src/Menu/_styles.scss | 1 + .../src/Test/TestApp.svelte | 4 +-- .../src/Test/props.js | 5 ++-- 6 files changed, 31 insertions(+), 41 deletions(-) diff --git a/packages/materialdesign-components/src/List/List.svelte b/packages/materialdesign-components/src/List/List.svelte index f1686c43ee..eae7018d1b 100644 --- a/packages/materialdesign-components/src/List/List.svelte +++ b/packages/materialdesign-components/src/List/List.svelte @@ -17,33 +17,24 @@ export let onSelect = selectedItems => {} export let singleSelection = false - export let variant = "two-line" + export let variant = "one-line" export let inputElement = null let selectedItemsStore let role = "listbox" - function createOrAcceptItemStore() { - let store = _bb.getContext("BBMD:list:selectItemStore") - if (!!store) { - selectedItemsStore = store - } else { - selectedItemsStore = createItemsStore(() => onSelect($selectedItemsStore)) - _bb.setContext("BBMD:list:selectItemStore", selectedItemsStore) - } - } - onMount(() => { - createOrAcceptItemStore() + let ctx = getContext("BBMD:list:context") - if (!_bb.getContext("BBMD:list:props")) { - _bb.setContext("BBMD:list:props", { - inputElement, - variant, - singleSelection, - }) - } + selectedItemsStore = createItemsStore(() => onSelect($selectedItemsStore)) + _bb.setContext("BBMD:list:selectItemStore", selectedItemsStore) + + _bb.setContext("BBMD:list:props", { + inputElement, + variant, + singleSelection, + }) if (!!list) { if (!inputElement) { diff --git a/packages/materialdesign-components/src/List/ListItem.svelte b/packages/materialdesign-components/src/List/ListItem.svelte index 775d73d2e2..979ea3e8b3 100644 --- a/packages/materialdesign-components/src/List/ListItem.svelte +++ b/packages/materialdesign-components/src/List/ListItem.svelte @@ -7,8 +7,6 @@ const cb = new ClassBuilder("list-item") - export let onClick = item => {} - let _id let listProps = null @@ -24,6 +22,7 @@ export let trailingIcon = "" export let selected = false export let disabled = false + export let dividerAfter = false let role = "option" @@ -110,3 +109,6 @@ {/if} +{#if dividerAfter} +