|
9 | 9 | widgetContents, |
10 | 10 | /** what's displayed when the widget is in modal mode*/ |
11 | 11 | modalContents, |
| 12 | + /** "more info" contents*/ |
| 13 | + extraModalContents, |
12 | 14 | } = $props(); |
13 | 15 |
|
14 | 16 | // TODO: support for "more info" is not currently |
15 | 17 | // implemented. When it is, it should not make use |
16 | 18 | // of IDs |
17 | | - let expanded = $state(false); |
| 19 | + let modalExpanded = $state(false); |
| 20 | + let moreInfoExpanded = $state(false); |
18 | 21 | </script> |
19 | 22 |
|
20 | 23 | <button |
21 | 24 | onclick={() => { |
22 | | - expanded = true; |
| 25 | + modalExpanded = true; |
23 | 26 | }} |
24 | 27 | class="_widget"> |
25 | 28 | <h1>{title}</h1> |
|
28 | 31 | </div> |
29 | 32 | </button> |
30 | 33 |
|
31 | | -{#if expanded} |
32 | | -<span class="backdrop" onclick={() => {expanded = false}} role="none"> |
| 34 | +{#if modalExpanded} |
| 35 | +<span class="backdrop" onclick={() => {modalExpanded = false}} role="none"> |
33 | 36 | </span> |
34 | 37 | <div class="_modal"> |
35 | 38 | <!-- modal header --> |
36 | 39 | <div> |
37 | 40 | <h5>{title}</h5> |
38 | | - <button onclick={() => {expanded = false;}} type="button" aria-label="Close" |
| 41 | + <button onclick={() => {modalExpanded = false;}} type="button" aria-label="Close" |
39 | 42 | ></button> |
40 | 43 | </div> |
41 | 44 |
|
42 | 45 | <div class="modal-body"> |
43 | 46 | {@render modalContents()} |
44 | 47 | </div> |
45 | 48 |
|
46 | | - <!-- more info --> |
47 | | - <!-- <div class="modal-body"> |
48 | | - {@render extraModalContents()} |
49 | | - </div> --> |
| 49 | + <!-- more info --> |
| 50 | + {#if extraModalContents && moreInfoExpanded == true} |
| 51 | + <div class="modal-body"> |
| 52 | + {@render extraModalContents()} |
| 53 | + </div> |
| 54 | + {/if} |
50 | 55 |
|
51 | 56 | <!-- footer --> |
52 | 57 | <div> |
53 | | - <!-- {#if extraModalContents} |
| 58 | + {#if extraModalContents && moreInfoExpanded == false} |
54 | 59 | <button |
55 | 60 | type="button" |
56 | 61 | class="btn btn-secondary" |
57 | | - id={modalId + '-more-info-button'} |
58 | | - onclick={() => infoClick(modalId)}>More Info</button |
| 62 | + onclick={() => {moreInfoExpanded = true}}>More Info</button |
59 | 63 | > |
60 | | - {/if} --> |
| 64 | + {/if} |
61 | 65 | <button |
62 | | - onclick={() => {expanded = false;}} |
| 66 | + onclick={() => {modalExpanded = false;}} |
63 | 67 | type="button">Close</button |
64 | 68 | > |
65 | 69 | </div> |
|
0 commit comments