Add Toast partial view and JS controller #448

Closed
mogery wants to merge 2 commits from mog/toast into main
mogery commented 2024-02-13 03:08:41 +08:00 (Migrated from github.com)

Fixes #447
/claim #447

This PR adds a shared partial view _toast.html.erb. This partial view can be used to render a notification, like described in #447. The toast's timer and disappearing logic is driven by the toast_controller.js Stimulus controller.

A notification can be triggered by rendering the toast view. Examples (from Figma):

<%= render "shared/toast", success: true, content: "Emergency cash has been successfully created" %>
<%= render "shared/toast", success: false, content: "Account addition failed" %>

Opinionated implementation choices:

  • The toast's background turns to #FDFDFD when hovered.
Fixes #447 /claim #447 This PR adds a shared partial view `_toast.html.erb`. This partial view can be used to render a notification, like described in #447. The toast's timer and disappearing logic is driven by the `toast_controller.js` Stimulus controller. A notification can be triggered by rendering the toast view. Examples (from Figma): ```erb <%= render "shared/toast", success: true, content: "Emergency cash has been successfully created" %> <%= render "shared/toast", success: false, content: "Account addition failed" %> ``` Opinionated implementation choices: - The toast's background turns to `#FDFDFD` when hovered.

Pull request closed

Sign in to join this conversation.