zerodevx / svelte-toast

Simple elegant toast notifications
https://zerodevx.github.io/svelte-toast/
ISC License
835 stars 49 forks source link

Issue: Pico.CSS styling leaked into Toast Styling #82

Open ZombieChibiXD opened 1 year ago

ZombieChibiXD commented 1 year ago

Hi, I wanted to use this toast package, but because I'm using PicoCSS, there's issue where the main styling leaked into this package.

Is there a way to make sure this toast's styling is scoped to itself?

ZombieChibiXD commented 1 year ago

So far my workaround is by making a component and styling it manually.

<script>
    import { SvelteToast } from '@zerodevx/svelte-toast';
</script>

<div class="toast">
    <SvelteToast
        options={{
            classes: ['something']
        }}
    />
</div>

<style>
    :global(ul._toastContainer>li) {
        list-style: none;
    }
    :global(._toastBtn) {
        --background-color: none;
        --border-color: none;
        --color: none;
        --box-shadow: none;
        --primary-hover: none;
        padding: var(--form-element-spacing-vertical) var(--form-element-spacing-horizontal);
        border: none;
        border-radius: 0;
        outline: 0;
    }
    :global(._toastBar) {
        border-radius: 0;
        margin-bottom: auto;
    }
</style>
zerodevx commented 1 year ago

Hey, unfortunately I don't think there's a straightforward solution (unless the toast component is set up as a custom element - which it's not right now). The drawback of using a CSS framework like PicoCSS is it's a bit like a sledgehammer.

Your workaround is probably fine.