|
19 | 19 | // interactive example
|
20 | 20 | // position, bannerType, color, class:divClass
|
21 | 21 | const colors = Object.keys(banner.variants.color);
|
22 |
| - let position: BannerProps["position"] = $state("sticky"); |
23 |
| - const changePosition = () => { |
24 |
| - position = position === "sticky" ? "absolute" : "sticky"; |
25 |
| - if (position === "sticky") { |
26 |
| - bannerType = "default"; |
27 |
| - } |
28 |
| - }; |
29 |
| - let bannerType: BannerProps["bannerType"] = $state("default"); |
30 |
| - const changeBannerType = () => { |
31 |
| - bannerType = bannerType === "default" ? "cta" : "default"; |
32 |
| - if (bannerType === "cta") { |
33 |
| - position = "absolute"; |
34 |
| - } |
35 |
| - }; |
| 22 | + // let position: BannerProps["type"] = $state("top"); |
| 23 | + // const changePosition = () => { |
| 24 | + // position = position === "top" ? "bottom" : "top"; |
| 25 | + // }; |
| 26 | + // let bannerType: BannerProps["type"] = $state("top"); |
| 27 | + // const changeBannerType = () => { |
| 28 | + // bannerType = bannerType === "default" ? "cta" : "default"; |
| 29 | + // if (bannerType === "cta") { |
| 30 | + // } |
| 31 | + // }; |
36 | 32 | let color: BannerProps["color"] = $state("primary");
|
37 |
| - let bannerClass: BannerProps["class"] = $state(""); |
| 33 | + $inspect('color', color); |
| 34 | + let bannerClass: BannerProps["class"] = $state("absolute"); |
38 | 35 | const changeClass = () => {
|
39 | 36 | bannerClass = bannerClass === "" ? "mt-4" : "";
|
40 | 37 | };
|
|
66 | 63 | // position, bannerType color, class
|
67 | 64 | let props = [];
|
68 | 65 | if (color !== "primary") props.push(` color="${color}"`);
|
69 |
| - if (bannerType !== "default") props.push(` bannerType="${bannerType}"`); |
70 |
| - if (position !== "sticky") props.push(` position="${position}"`); |
71 | 66 | if (bannerClass) props.push(` class="${bannerClass}"`);
|
72 | 67 | if (!bannerStatus) props.push(" bannerStatus={false}");
|
73 | 68 | if (currentTransition !== transitions[0]) {
|
|
120 | 115 | <Skeleton class="py-4" />
|
121 | 116 | <ImagePlaceholder class="py-4" />
|
122 | 117 | </div>
|
123 |
| - <Banner id="sample-banner" {position} {bannerType} {color} class={bannerClass} bind:bannerStatus transition={currentTransition.transition} params={currentTransition.params}> |
| 118 | + <Banner id="sample-banner" {color} bind:open={bannerStatus} class={bannerClass} transition={currentTransition.transition} params={currentTransition.params}> |
124 | 119 | <p class="flex items-center text-sm font-normal text-gray-500 dark:text-gray-400">
|
125 | 120 | <span class="me-3 inline-flex rounded-full bg-gray-200 p-1 dark:bg-gray-600">
|
126 | 121 | <BullhornOutline class="h-3 w-3 text-gray-500 dark:text-gray-400" />
|
|
148 | 143 | <Radio labelClass="w-16 my-1" name="interactive_transition" bind:group={selectedTransition} value={transition.name}>{transition.name}</Radio>
|
149 | 144 | {/each}
|
150 | 145 | </div>
|
151 |
| - <div class="flex flex-wrap justify-center gap-2 md:justify-start"> |
152 |
| - <Button class="w-40" onclick={changePosition}>Position: {position === "sticky" ? "absolute" : "sticky"}</Button> |
153 |
| - <Button class="w-40" color="blue" onclick={changeBannerType}>Type: {bannerType === "default" ? "cta" : "default"}</Button> |
154 |
| - <Button class="w-40" color="green" onclick={changeClass}>{bannerClass ? "Remove class" : "Add class"}</Button> |
155 |
| - </div> |
156 | 146 | </div>
|
157 | 147 | {#snippet codeblock()}
|
158 | 148 | <DynamicCodeBlockHighlight handleExpandClick={handleBuilderExpandClick} expand={builderExpand} showExpandButton={showBuilderExpandButton} code={generatedCode} />
|
|
0 commit comments