Skip to content

Commit

Permalink
Add animation that shows notification duration to the user (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
ail3ngrimaldi authored Nov 12, 2024
1 parent 39b447f commit 71f21c7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
34 changes: 33 additions & 1 deletion public/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ $fw-bold: 700;
.notification {
background: var(--background-modal);
color: var(--text-primary);
border: 1px solid transparent;
border: 0px;
padding: var(--size-1);
text-align: left;
position: absolute;
Expand All @@ -675,6 +675,38 @@ $fw-bold: 700;
margin-top: var(--size-0);
}

.notification__progress {
border-bottom-left-radius: 18px;
border-bottom-right-radius: 18px;
position: absolute;
left: 0;
bottom: 0;
height: 6px;
width: 0%;
animation: fill-progress 2500ms ease-out forwards;
}

@keyframes fill-progress {
from {
width: 0%;
}
to {
width: 100%;
}
}

.notification--success .notification__progress {
background-color: #4caf50;
}

.notification--error .notification__progress {
background-color: #f44336;
}

.notification--warning .notification__progress {
background-color: #ff9800;
}

.notification--error {
background: var(--color-red-50);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/atoms/notification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub fn Notification(props: NotificationProps) -> Element {
onclick: move |event| props.on_click.call(event),
h3 { class: "notification__title", "{props.title}" }
p { class: "notification__body", "{props.body}" }
div { class: "notification__progress" }
}
)
}

0 comments on commit 71f21c7

Please sign in to comment.