budibase/packages/bbui/src/Banner/BannerDisplay.svelte

40 lines
1.0 KiB
Svelte
Raw Normal View History

<script>
import "@spectrum-css/toast/dist/index-vars.css"
import Portal from "svelte-portal"
import { banner } from "../Stores/banner"
import Banner from "./Banner.svelte"
import { fly } from "svelte/transition"
2022-09-13 12:52:31 +02:00
import TooltipWrapper from "../Tooltip/TooltipWrapper.svelte"
</script>
<Portal target=".banner-container">
<div class="banner">
2022-09-13 12:52:31 +02:00
{#each $banner.messages as message}
<div transition:fly={{ y: -30 }}>
<Banner
2022-09-13 12:52:31 +02:00
type={message.type}
extraButtonText={message.extraButtonText}
extraButtonAction={message.extraButtonAction}
on:change={() => {
message.onChange()
}}
showCloseButton={typeof message.showCloseButton === "boolean"
? message.showCloseButton
: true}
>
2022-09-13 12:52:31 +02:00
<TooltipWrapper tooltip={"test"}>
{message.message}
</TooltipWrapper>
</Banner>
</div>
2022-09-13 12:52:31 +02:00
{/each}
</div>
</Portal>
<style>
.banner {
pointer-events: none;
width: 100%;
}
</style>