Added toast style and comp

This commit is contained in:
Alexis
2021-03-20 00:03:04 +01:00
parent 6784667b92
commit bbc4744eed
5 changed files with 147 additions and 1 deletions

View File

@@ -4,16 +4,19 @@
<div class="fs-content"> <div class="fs-content">
<router-view /> <router-view />
</div> </div>
<toasts-list />
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import Navbar from "@/components/Navbar.vue"; import Navbar from "@/components/Navbar.vue";
import ToastsList from "@/components/toast/ToastsList.vue";
export default defineComponent({ export default defineComponent({
components: { components: {
Navbar Navbar,
ToastsList,
} }
}); });
</script> </script>

View File

@@ -36,6 +36,15 @@
} }
} }
@keyframes slideFromRight {
from {
transform: translateX(100%);
}
to {
transform: translateX(0);
}
}
@keyframes paneBgAround { @keyframes paneBgAround {
0% { 0% {
background-position: -10vw 0%; background-position: -10vw 0%;

View File

@@ -8,6 +8,16 @@ $space-blue-600: #234e69;
$space-blue-500: #457b9d; $space-blue-500: #457b9d;
$space-blue-300: #a8dadc; $space-blue-300: #a8dadc;
$blue: #306BAC;
$green: #1c8267;
$orange: #ff9844;
$red: #9f2042;
$info: $blue;
$valid: $green;
$warning: $orange;
$danger: $red;
$primary: $space-blue-700; $primary: $space-blue-700;
$primary-light: $space-blue-600; $primary-light: $space-blue-600;

View File

@@ -0,0 +1,61 @@
<template>
<div class="toast-card" :class="variant">
<div class="toast-title">
<slot name="title" />
</div>
<div class="toast-message">
<slot name="message" />
</div>
</div>
</template>
<script>
import { defineComponent } from "vue";
export default defineComponent({
name: "ToastCard",
props: {
variant: String
}
});
</script>
<style lang="scss" scoped>
.toast-card {
position: relative;
padding: 20px 30px 26px;
border-radius: 5px;
animation: fadeIn 1s cubic-bezier(0.175, 1, 0.32, 1),
slideFromRight 1s cubic-bezier(0.175, 1, 0.32, 1);
overflow: hidden;
.toast-title {
margin-bottom: 5px;
font-size: 16px;
font-weight: $fw-bold;
}
&:after {
position: absolute;
display: block;
content: "";
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 6px;
background: rgba($fs-black, 33%);
}
&.info {
background-color: $info;
}
&.valid {
background-color: $valid;
}
&.warning {
color: $fs-black;
background-color: $warning;
}
&.danger {
background-color: $danger;
}
}
</style>

View File

@@ -0,0 +1,63 @@
<template>
<div class="toast-wrapper">
<div class="toast-item">
<toast-card variant="info">
<template #title>Toast informant</template>
<template #message>
Ce message est utilisé pour informer.
</template>
</toast-card>
</div>
<div class="toast-item">
<toast-card variant="valid">
<template #title>Toast validant</template>
<template #message>
Ce message est utilisé pour valider.
</template>
</toast-card>
</div>
<div class="toast-item">
<toast-card variant="warning">
<template #title>Toast avertissant</template>
<template #message>
Ce message est utilisé pour avertir.
</template>
</toast-card>
</div>
<div class="toast-item">
<toast-card variant="danger">
<template #title>Toast d'alerte</template>
<template #message>
Ce message est utilisé pour alerter.
</template>
</toast-card>
</div>
</div>
</template>
<script>
import { defineComponent } from "vue";
import ToastCard from "./ToastCard.vue";
export default defineComponent({
name: "ToastsList",
components: {
ToastCard
}
});
</script>
<style lang="scss" scoped>
.toast-wrapper {
position: fixed;
top: 90px;
height: 100%;
right: 0;
pointer-events: none;
.toast-item {
pointer-events: all;
margin-right: 20px;
margin-bottom: 20px;
}
}
</style>