Skip to content

Commit

Permalink
Merge pull request #68 from TelosLabs/feature/update-flash-messages
Browse files Browse the repository at this point in the history
Update flash messages
  • Loading branch information
LuigiR0jas committed Jul 30, 2024
2 parents c8d0b10 + 3cde17f commit 350e973
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
16 changes: 16 additions & 0 deletions app/javascript/controllers/closable_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Controller } from '@hotwired/stimulus'

export default class extends Controller {
connect () {
this.close()
}

close (event) {
setTimeout(() => {
this.element.classList.add('opacity-0')
setTimeout(() => {
this.element.remove()
}, 300)
}, 3000)
}
}
5 changes: 5 additions & 0 deletions app/views/layouts/_flash_message.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div class="flex flex-col items-center justify-center fixed bottom-[64px] w-full z-20">
<div data-controller="closable" class="bg-black/70 shadow-simple backdrop-blur-[25px] rounded-lg px-5 py-4 absolute transition-all bottom-0 max-w-screen-sm text-white z-20 sticky">
<%= message %>
</div>
</div>
3 changes: 1 addition & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
<% end %>
<% flash.each do |type, message| %>
<% if message.present? && message.is_a?(String) %>
<div><%= notice %></div>
<div><%= alert %></div>
<%= render partial: "layouts/flash_message", locals: { message: message }%>
<% end %>
<% end %>
<%= yield %>
Expand Down
6 changes: 5 additions & 1 deletion config/tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ module.exports = {
],
theme: {
extend: {
boxShadow: {
'simple': '0px 0px 25px 0px rgba(0, 0, 0, 0.50)'
},
fontFamily: {
sans: ['Roboto', ...defaultTheme.fontFamily.sans]
},
Expand All @@ -21,13 +24,14 @@ module.exports = {
'gray-7': '#D7D7D8',
'gray-6': '#C6C6C8',
'gray-5': '#A2A2A2',
'gray-3': '#262626',
'purple-dark': '#432463',
'purple-light': '#4E2A73',
red: '#CB0C1C',
blue: '#0A4E6B',
'green-dark': '#62C554',
'green-light': '#D8F1D4'
}
},
}
},
plugins: [
Expand Down

0 comments on commit 350e973

Please sign in to comment.