Class: Avo::Fields::Common::Files::ListViewerComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Avo::Fields::Common::Files::ListViewerComponent
- Includes:
- Turbo::FramesHelper
- Defined in:
- app/components/avo/fields/common/files/list_viewer_component.rb
Instance Method Summary collapse
- #available_view_types ⇒ Object
- #classes ⇒ Object
-
#initialize(field:, resource:) ⇒ ListViewerComponent
constructor
A new instance of ListViewerComponent.
Constructor Details
#initialize(field:, resource:) ⇒ ListViewerComponent
Returns a new instance of ListViewerComponent.
6 7 8 9 |
# File 'app/components/avo/fields/common/files/list_viewer_component.rb', line 6 def initialize(field:, resource:) @field = field @resource = resource end |
Instance Method Details
#available_view_types ⇒ Object
23 24 25 |
# File 'app/components/avo/fields/common/files/list_viewer_component.rb', line 23 def available_view_types [:list, :grid] end |
#classes ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/components/avo/fields/common/files/list_viewer_component.rb', line 11 def classes base_classes = "py-4 rounded-xl" view_type_classes = if @field.view_type == :list "flex flex-col space-y-2" else "relative grid xs:grid-cols-2 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-6 gap-6" end "#{base_classes} #{view_type_classes}" end |