Skip to content

Instantly share code, notes, and snippets.

@crummy
Created April 26, 2020 07:31
Show Gist options
  • Save crummy/84ce7fbcbe0055bb8c1682424abbef18 to your computer and use it in GitHub Desktop.
Save crummy/84ce7fbcbe0055bb8c1682424abbef18 to your computer and use it in GitHub Desktop.
<script context="module">
let title, message;
let warning = false
export const error = (m, t) => {
message = m
title = t
warning = true
console.log(message)
}
export const info = (m, t) => {
message = m
title = t
warning = false
}
</script>
{#if message}
<div id="message" class:warning={warning}>
{#if title}
<div id="title">{title}</div>
{/if}
{message}
</div>
{/if}
<style>
#message {
background-color: lightblue;
padding: 1em;
margin: 1em;
}
.warning {
background-color: orangered !important;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment