Class: PhlexKit::AttachmentGroup

Inherits:
BaseComponent show all
Defined in:
app/components/phlex_kit/attachment/attachment_group.rb

Overview

Horizontally scrollable, snapping row of Attachments with an edge fade (the phlex-kit--scroll-fade controller in horizontal mode). See attachment.rb.

Instance Method Summary collapse

Methods inherited from BaseComponent

#on

Constructor Details

#initialize(**attrs) ⇒ AttachmentGroup

Returns a new instance of AttachmentGroup.



6
7
8
# File 'app/components/phlex_kit/attachment/attachment_group.rb', line 6

def initialize(**attrs)
  @attrs = attrs
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/phlex_kit/attachment/attachment_group.rb', line 10

def view_template(&)
  div(**mix({
    class: "pk-attachment-group",
    role: "group",
    # at-start + at-end = no edge fades. Server-rendered so a group that
    # FITS shows no false "more content" fade pre-hydration / with JS off;
    # the controller's first update() removes them when there's overflow.
    data: {
      controller: "phlex-kit--scroll-fade",
      phlex_kit__scroll_fade_axis_value: "x",
      at_start: "",
      at_end: ""
    }
  }, @attrs), &)
end