This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const languages = { | |
Home: { | |
Encrypt: { | |
en: "Encrypt", | |
it: "Cifra", | |
}, | |
"Encrypt your text": { | |
en: "Encrypt your text", | |
it: "Cifra un messaggio di testo", | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { writable } from "svelte/store"; | |
import type { Writable } from "svelte/store"; | |
const languageStore: Writable<string> = writable("en"); | |
const lang = { | |
subscribe: languageStore.subscribe, | |
set: (language: string) => { | |
languageStore.set(language); | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
import notifications from "../Notification/Notification"; | |
const goHome = () => { | |
page.set("Home"); | |
if ($password != "") { | |
password.set(""); | |
notifications.send({ | |
message: "Password cleared", | |
type: "danger", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import notifications from "./Notification"; | |
const copyText = () => { | |
navigator.clipboard.writeText(cipherText); | |
notifications.send({ | |
message: "Copied to clipboard", | |
type: "success", | |
timeout: 1500, | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// ... | |
import Notification from "./Notification.svelte"; | |
// ... | |
</script> | |
<Notification /> | |
<Header /> | |
<main> | |
<!-- ... --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script lang="ts"> | |
import { flip } from "svelte/animate"; | |
import { fly } from "svelte/transition"; | |
import notifications from "./Notification"; | |
export let themes = { | |
danger: "#E26D69", | |
success: "#1f8c34", | |
warning: "#f0ad4e", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { flip } from "svelte/animate"; | |
import { fly } from "svelte/transition"; | |
</script> | |
<!-- ... --> | |
<div | |
animate:flip | |
class="toast" | |
style="background: {themes[notification.msg.type]};" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
export let themes = { | |
danger: "#E26D69", | |
success: "#1f8c34", | |
warning: "#f0ad4e", | |
info: "#5bc0de", | |
default: "#aaaaaa", | |
}; | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.notifications { | |
position: fixed; | |
top: 64px; | |
left: 0; | |
right: 8px; | |
margin: 0 auto; | |
padding: 0; | |
z-index: 9999; | |
display: flex; | |
flex-direction: column; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="notifications"> | |
{#each $notifications as notification (notification.id)} | |
<div class="toast"> | |
<div class="content">{notification.msg.message}</div> | |
</div> | |
{/each} | |
</div> |