From 3b8d499171b344f5ccf320f1e5ef4e46a3206d35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Pe=CC=81ault?= Date: Sun, 11 Jun 2023 22:39:37 +0200 Subject: [PATCH] feat: create Toast component --- .../src/components/molecules/Toast.svelte | 111 ++++++++++++++++ apps/website/src/style/molecules/_toast.scss | 120 ++++++++++++++++++ 2 files changed, 231 insertions(+) create mode 100644 apps/website/src/components/molecules/Toast.svelte create mode 100644 apps/website/src/style/molecules/_toast.scss diff --git a/apps/website/src/components/molecules/Toast.svelte b/apps/website/src/components/molecules/Toast.svelte new file mode 100644 index 0000000..9a033fd --- /dev/null +++ b/apps/website/src/components/molecules/Toast.svelte @@ -0,0 +1,111 @@ + + + + +{#if show} +
+ {#if images} + + {/if} + +
+

{@html text}

+ + {#if cta} +
+ + +
+{/if} diff --git a/apps/website/src/style/molecules/_toast.scss b/apps/website/src/style/molecules/_toast.scss new file mode 100644 index 0000000..dccc389 --- /dev/null +++ b/apps/website/src/style/molecules/_toast.scss @@ -0,0 +1,120 @@ +.toast { + display: flex; + align-items: center; + padding: 8px; + padding-right: 28px; + background: #fff; + border-radius: 8px; + + @include bp (md) { + padding-right: 32px; + } +} + +// Media +.media { + position: relative; + overflow: hidden; + flex-shrink: 0; + flex: 0 0 clamp(40px, 14vw, 64px); + aspect-ratio: 1 / 1.25; + height: 100%; + margin-right: 16px; + border-radius: 4px; + + @include bp (md) { + flex: 0 0 min(7vw, 104px); + margin-right: 24px; + } + + a { + display: block; + width: 100%; + height: 100%; + } + + :global(picture) { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + opacity: 0; + transform: scale(1.075); + transition: opacity 0.8s, transform 1.6s var(--ease-quart); + } + :global(img) { + object-position: center 32%; + } + + :global(.is-visible) { + opacity: 1; + transform: scale(1); + } + + :global(img) { + display: block; + width: 100%; + height: 100%; + object-fit: cover; + + @include bp (sm) { + position: absolute; + top: 0; + left: 0; + height: 100%; + + } + } +} + +// Content +.content { + color: $color-text; + font-size: rem(14px); + + @include bp (md) { + font-size: rem(16px); + } + + .text { + margin-bottom: 12px; + + @include bp (md) { + margin-bottom: 20px; + } + } + + :global(strong) { + font-weight: normal; + color: $color-secondary; + } +} + +// Close +.close { + --size: 28px; + position: absolute; + top: 0; + right: 0; + width: var(--size); + height: var(--size); + display: flex; + align-items: center; + justify-content: center; + + @include bp (sm) { + --size: 32px; + } + + :global(svg) { + transition: transform 0.6s var(--ease-quart); + } + + // Hover + &:hover { + :global(svg) { + transform: rotate(90deg) translateZ(0); + } + } +}