Class: Protos::Toast

Inherits:
Component show all
Defined in:
lib/protos/toast.rb,
lib/protos/toast/close_button.rb

Defined Under Namespace

Classes: CloseButton

Constant Summary collapse

Positions =

DOCS: A toast component that can be used to display messages to the user that popup at a fixed position on the screen. daisyui.com/components/toast/

Types::Symbol.enum(
  :top_start,
  :top_center,
  :top_end,
  :middle_start,
  :middle_center,
  :middle_end,
  :bottom_start,
  :bottom_center,
  :bottom_end
)
POSITIONS =
{
  top_start: "toast-start toast-top",
  top_center: "toast-center toast-top",
  top_end: "toast-end toast-top",
  middle_start: "toast-start toast-middle",
  middle_center: "toast-center toast-middle",
  middle_end: "toast-end toast-middle",
  bottom_start: "toast-start toast-bottom",
  bottom_center: "toast-center toast-bottom",
  bottom_end: "toast-end toast-bottom"
}.freeze

Instance Method Summary collapse

Methods inherited from Component

#initialize

Constructor Details

This class inherits a constructor from Protos::Component

Instance Method Details

#close_buttonObject



42
# File 'lib/protos/toast.rb', line 42

def close_button(...) = render CloseButton.new(...)

#view_templateObject



38
39
40
# File 'lib/protos/toast.rb', line 38

def view_template(&)
  dialog(**attrs, &)
end