Class: TransitionComponent

Inherits:
Component show all
Defined in:
app/components/transition_component.rb

Overview

Transition — CSS animation framework.

Usage:

Transition(animation: :fade, visible: true) { text "Fading content" }
Transition(animation: :scale, duration: 500) { text "Scaling content" }

Constant Summary

Constants inherited from Component

Component::HTML_OPTIONS

Instance Method Summary collapse

Methods inherited from Component

default, #initialize, #render_in, slot

Constructor Details

This class inherits a constructor from Component

Instance Method Details

#to_sObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/components/transition_component.rb', line 14

def to_s
  classes = class_names(
    animation,
    { "visible" => visible,
      "hidden" => !visible },
    "transition"
  )

  tag.div(
    class: classes,
    style: "animation-duration:#{duration}ms",
    data: {
      controller: "fui-transition",
      fui_transition_animation_value: animation,
      fui_transition_duration_value: duration
    }
  ) { @content }
end