sdr_view_components 0.1.14 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +55 -38
- data/app/assets/sdr_view_components.css +110 -0
- data/app/components/sdr_view_components/elements/heading_component.rb +3 -1
- data/app/components/sdr_view_components/elements/icon_button_component.rb +10 -0
- data/app/components/sdr_view_components/elements/spinner_component.html.erb +2 -2
- data/app/components/sdr_view_components/elements/spinner_component.rb +5 -4
- data/app/components/sdr_view_components/elements/tabs/pane_component.html.erb +3 -0
- data/app/components/sdr_view_components/elements/tabs/pane_component.rb +27 -0
- data/app/components/sdr_view_components/elements/tabs/tab_component.html.erb +3 -0
- data/app/components/sdr_view_components/elements/tabs/tab_component.rb +42 -0
- data/app/components/sdr_view_components/elements/tabs/tab_list_component.html.erb +9 -0
- data/app/components/sdr_view_components/elements/tabs/tab_list_component.rb +33 -0
- data/app/components/sdr_view_components/elements/toast_component.rb +1 -1
- data/app/components/sdr_view_components/tables/base_table_component.html.erb +32 -0
- data/app/components/sdr_view_components/tables/base_table_component.rb +69 -0
- data/app/components/sdr_view_components/tables/cell_component.html.erb +3 -0
- data/app/components/sdr_view_components/tables/cell_component.rb +21 -0
- data/app/components/sdr_view_components/tables/header_component.html.erb +4 -0
- data/app/components/sdr_view_components/tables/header_component.rb +22 -0
- data/app/components/sdr_view_components/tables/list_cell_component.html.erb +5 -0
- data/app/components/sdr_view_components/tables/list_cell_component.rb +22 -0
- data/app/components/sdr_view_components/tables/raw_table_component.rb +10 -0
- data/app/components/sdr_view_components/tables/row_component.html.erb +24 -0
- data/app/components/sdr_view_components/tables/row_component.rb +32 -0
- data/app/components/sdr_view_components/tables/table_component.rb +10 -0
- data/app/views/layouts/lookbook.html.erb +46 -0
- data/lib/sdr_view_components/configuration.rb +22 -0
- data/lib/sdr_view_components/engine.rb +17 -7
- data/lib/sdr_view_components/error.rb +7 -0
- data/lib/sdr_view_components/version.rb +1 -1
- data/lib/sdr_view_components.rb +2 -0
- data/spec/components/previews/sdr_view_components/elements/alert_component_preview.rb +71 -0
- data/spec/components/previews/sdr_view_components/elements/banner_component_preview.rb +58 -0
- data/spec/components/previews/sdr_view_components/elements/breadcrumb_nav_component_preview.rb +52 -0
- data/spec/components/previews/sdr_view_components/elements/button_component_preview.rb +71 -0
- data/spec/components/previews/sdr_view_components/elements/button_form_component_preview.rb +97 -0
- data/spec/components/previews/sdr_view_components/elements/button_link_component_preview.rb +81 -0
- data/spec/components/previews/sdr_view_components/elements/card_component_preview.rb +41 -0
- data/spec/components/previews/sdr_view_components/elements/heading_component_preview.rb +51 -0
- data/spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview/default.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/elements/horizontal_rule_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/elements/icon_button_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/elements/icon_button_link_component_preview.rb +15 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/with_header_and_footer.html.erb +19 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview/without_size.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/elements/modal_component_preview.rb +15 -0
- data/spec/components/previews/sdr_view_components/elements/progress_bar_component_preview.rb +97 -0
- data/spec/components/previews/sdr_view_components/elements/spinner_component_preview.rb +83 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/default_variant.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/underline_variant.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview/with_header.html.erb +16 -0
- data/spec/components/previews/sdr_view_components/elements/tabs/tab_list_component_preview.rb +16 -0
- data/spec/components/previews/sdr_view_components/elements/toast_component_preview.rb +29 -0
- data/spec/components/previews/sdr_view_components/elements/tooltip_component_preview/default.html.erb +13 -0
- data/spec/components/previews/sdr_view_components/elements/tooltip_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/checked.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview/disabled.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_checkbox_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_accept.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_multiple.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview/with_required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_file_component_preview.rb +25 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/checked.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview/disabled.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_radio_button_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_placeholder.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview/with_rows.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_area_component_preview.rb +19 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/default.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/disabled.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/required.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview/with_placeholder.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/basic/basic_text_field_component_preview.rb +19 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/checked.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/disabled.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_help_text.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview/with_validation_error.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/checkbox_component_preview.rb +33 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_additional_container_content.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_multiple.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview/with_validation_error.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/file_component_preview.rb +32 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_block_content.html.erb +3 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview/with_text.html.erb +4 -0
- data/spec/components/previews/sdr_view_components/forms/help_text_component_preview.rb +13 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/hidden_label.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_caption.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview/with_tooltip.html.erb +17 -0
- data/spec/components/previews/sdr_view_components/forms/label_component_preview.rb +17 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_additional_container_content.html.erb +14 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_help_text_below.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_label.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview/with_validation_error.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/radio_button_component_preview.rb +30 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/danger.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/default.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/info.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/primary.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/secondary.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/success.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/warning.html.erb +6 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_block_content_and_value.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview/with_form_id.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/submit_component_preview.rb +29 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_hidden_label.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_mark_required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview/with_validation_error.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_area_component_preview.rb +32 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/default.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/disabled.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/label_hidden.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/marked_required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/required.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_additional_container_content.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_help_text_below.html.erb +10 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_placeholder.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview/with_validation_error.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/forms/text_field_component_preview.rb +40 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/default.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview/with_validation_error.html.erb +12 -0
- data/spec/components/previews/sdr_view_components/forms/toggle_component_preview.rb +20 -0
- data/spec/components/previews/sdr_view_components/structure/footer_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/dark_variant_with_background_color.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/light_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/no_rosette.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview/white_variant.html.erb +15 -0
- data/spec/components/previews/sdr_view_components/structure/header_component_preview.rb +16 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview/default.html.erb +9 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview/with_colspan.html.erb +17 -0
- data/spec/components/previews/sdr_view_components/tables/cell_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview/default.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview/with_tooltip.html.erb +19 -0
- data/spec/components/previews/sdr_view_components/tables/header_component_preview.rb +11 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_item_values.html.erb +7 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview/with_items.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/tables/list_cell_component_preview.rb +27 -0
- data/spec/components/previews/sdr_view_components/tables/raw_table_component_preview/default.html.erb +26 -0
- data/spec/components/previews/sdr_view_components/tables/raw_table_component_preview.rb +9 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/label_only.html.erb +5 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_cells.html.erb +13 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_first_value_and_values.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_label_content.html.erb +11 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_tooltip.html.erb +18 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_value.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview/with_values.html.erb +8 -0
- data/spec/components/previews/sdr_view_components/tables/row_component_preview.rb +21 -0
- data/spec/components/previews/sdr_view_components/tables/table_component_preview.rb +81 -0
- metadata +163 -6
- data/app/assets/stylesheets/styles.scss +0 -118
- data/app/components/component_support/file_hierarchy.rb +0 -22
- data/app/components/sdr_view_components/forms/button_component.rb +0 -42
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Tables
|
|
5
|
+
# Component for rendering a table row.
|
|
6
|
+
class RowComponent < BaseComponent
|
|
7
|
+
renders_many :cells, SdrViewComponents::Tables::CellComponent
|
|
8
|
+
renders_one :label_content
|
|
9
|
+
|
|
10
|
+
def initialize(label: nil, first_value: nil, values: [], value: nil, tooltip: nil, **row_options) # rubocop:disable Metrics/ParameterLists
|
|
11
|
+
# Provide either label or first_value but not both; these are rendered in the first column
|
|
12
|
+
# label renders with <th> (bold), first_value is a normal <td>
|
|
13
|
+
@label = label
|
|
14
|
+
@first_value = first_value
|
|
15
|
+
# Provide either value, values or cells (e.g. for content files).
|
|
16
|
+
@values = Array(value).presence || values
|
|
17
|
+
@tooltip = tooltip
|
|
18
|
+
@row_options = row_options
|
|
19
|
+
|
|
20
|
+
raise ArgumentError if label.present? && first_value.present?
|
|
21
|
+
|
|
22
|
+
super()
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
attr_reader :label, :values, :tooltip, :first_value, :row_options
|
|
26
|
+
|
|
27
|
+
def empty_cell?
|
|
28
|
+
label.present? && values.empty? && !cells?
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<title><%= content_for(:title) || 'Lookbook' %></title>
|
|
6
|
+
|
|
7
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
8
|
+
|
|
9
|
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
10
|
+
|
|
11
|
+
<meta name="application-name" content="Lookbook">
|
|
12
|
+
|
|
13
|
+
<meta name="mobile-web-app-capable" content="yes">
|
|
14
|
+
|
|
15
|
+
<%= csrf_meta_tags %>
|
|
16
|
+
<%= csp_meta_tag %>
|
|
17
|
+
|
|
18
|
+
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
|
|
19
|
+
<%# = tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
|
|
20
|
+
|
|
21
|
+
<link rel="icon" href="/icon.png" type="image/png">
|
|
22
|
+
|
|
23
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml">
|
|
24
|
+
|
|
25
|
+
<link rel="apple-touch-icon" href="/icon.png">
|
|
26
|
+
|
|
27
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
|
|
28
|
+
<link
|
|
29
|
+
rel="stylesheet"
|
|
30
|
+
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css"
|
|
31
|
+
>
|
|
32
|
+
<%= tag.link rel: 'icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.png", type: 'image/png' %>
|
|
33
|
+
<%= tag.link rel: 'icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.svg", type: 'image/svg+xml' %>
|
|
34
|
+
<%= tag.link rel: 'apple-touch-icon', href: "#{SdrViewComponents.configuration.component_library_url}/styles/icon.png" %>
|
|
35
|
+
|
|
36
|
+
<%= stylesheet_link_tag 'sdr_view_components', 'data-turbo-track': 'reload' %>
|
|
37
|
+
<%= tag.link rel: 'stylesheet', href: "#{SdrViewComponents.configuration.component_library_url}/styles/sul.css" %>
|
|
38
|
+
</head>
|
|
39
|
+
|
|
40
|
+
<body>
|
|
41
|
+
<div class="container-fluid py-4">
|
|
42
|
+
<%= yield %>
|
|
43
|
+
</div>
|
|
44
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/js/bootstrap.bundle.min.js" integrity="sha384-FKyoEForCGlyvwx9Hj09JcYn3nv7wiPVlz7YYwJrWVcXK/BmnVDxM+D2scQbITxI" crossorigin="anonymous"></script>
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# SDR View Components module
|
|
4
|
+
module SdrViewComponents
|
|
5
|
+
# Configuration class for the SDR View Components gem
|
|
6
|
+
class Configuration
|
|
7
|
+
attr_accessor :component_library_url
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
# Default URL for the component library assets
|
|
11
|
+
@component_library_url = 'https://cdn.jsdelivr.net/gh/sul-dlss/component-library@v2026-01-27'
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def self.configuration
|
|
16
|
+
@configuration ||= Configuration.new
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def self.configure
|
|
20
|
+
yield configuration
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -7,19 +7,25 @@ module SdrViewComponents
|
|
|
7
7
|
class Engine < ::Rails::Engine
|
|
8
8
|
isolate_namespace SdrViewComponents
|
|
9
9
|
|
|
10
|
-
initializer 'sdr_view_components.
|
|
11
|
-
|
|
10
|
+
initializer 'sdr_view_components.preview_autoload', before: :set_autoload_paths do |app|
|
|
11
|
+
preview_path = root.join('spec/components/previews').to_s
|
|
12
|
+
app.config.autoload_paths |= [preview_path]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
initializer 'sdr_view_components.preview_paths' do |app|
|
|
16
|
+
preview_path = root.join('spec/components/previews').to_s
|
|
12
17
|
|
|
13
|
-
|
|
14
|
-
config.view_component.previews.paths << root.join('spec/components/previews')
|
|
18
|
+
app.config.view_component.previews.paths |= [preview_path] if app.config.view_component.respond_to?(:previews)
|
|
15
19
|
|
|
16
|
-
#
|
|
17
|
-
config.
|
|
20
|
+
# Lookbook direct config
|
|
21
|
+
if app.config.respond_to?(:lookbook) && app.config.lookbook.respond_to?(:preview_paths)
|
|
22
|
+
app.config.lookbook.preview_paths |= [preview_path]
|
|
23
|
+
end
|
|
18
24
|
end
|
|
19
25
|
|
|
20
26
|
initializer 'sdr_view_components.assets' do |app|
|
|
27
|
+
app.config.assets.paths << Engine.root.join('app', 'assets').to_s
|
|
21
28
|
app.config.assets.paths << Engine.root.join('app', 'assets', 'stylesheets').to_s
|
|
22
|
-
app.config.assets.precompile += %w[sdr_view_components.css]
|
|
23
29
|
end
|
|
24
30
|
|
|
25
31
|
initializer 'sdr_view_components.helpers' do
|
|
@@ -27,5 +33,9 @@ module SdrViewComponents
|
|
|
27
33
|
include SdrViewComponents::Helpers
|
|
28
34
|
end
|
|
29
35
|
end
|
|
36
|
+
|
|
37
|
+
initializer 'sdr_view_components.configure_lookbook' do
|
|
38
|
+
config.view_component.previews.default_layout = 'lookbook'
|
|
39
|
+
end
|
|
30
40
|
end
|
|
31
41
|
end
|
data/lib/sdr_view_components.rb
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class AlertComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Information', variant: :info) do
|
|
9
|
+
'This is an informational alert.'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def danger
|
|
14
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Error', variant: :danger) do
|
|
15
|
+
'This is a danger alert.'
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success
|
|
20
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Success', variant: :success) do
|
|
21
|
+
'This is a success alert.'
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def note
|
|
26
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Note', variant: :note) do
|
|
27
|
+
'This is a note alert.'
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def warning
|
|
32
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Warning', variant: :warning) do
|
|
33
|
+
'This is a warning alert.'
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def input
|
|
38
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Input Required', variant: :input) do
|
|
39
|
+
'This is an input validation alert.'
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
# @!endgroup
|
|
43
|
+
|
|
44
|
+
def with_title_only
|
|
45
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Alert Title Only') do
|
|
46
|
+
'Content goes here.'
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def dismissible_alert
|
|
51
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Dismissible Alert', dismissible: true) do
|
|
52
|
+
'Click the X button to dismiss this alert.'
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# @!group Content Options
|
|
57
|
+
def with_text_property
|
|
58
|
+
render SdrViewComponents::Elements::AlertComponent
|
|
59
|
+
.new(title: 'Using Text Property',
|
|
60
|
+
text: 'This alert uses the text parameter instead of block content.')
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def with_block_content
|
|
64
|
+
render SdrViewComponents::Elements::AlertComponent.new(title: 'Using Block Content') do
|
|
65
|
+
'This alert uses block content, which can include HTML or other components.'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
# @!endgroup
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class BannerComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Variants
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::BannerComponent.new do |component|
|
|
9
|
+
component.with_header { 'Welcome to the Banner Component' }
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def note
|
|
14
|
+
render SdrViewComponents::Elements::BannerComponent.new(variant: :note) do |component|
|
|
15
|
+
component.with_header { 'Note: Important Information' }
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success
|
|
20
|
+
render SdrViewComponents::Elements::BannerComponent.new(variant: :success) do |component|
|
|
21
|
+
component.with_header { 'Success: Action Completed' }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def warning
|
|
26
|
+
render SdrViewComponents::Elements::BannerComponent.new(variant: :warning) do |component|
|
|
27
|
+
component.with_header { 'Warning: Please Review' }
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def info
|
|
32
|
+
render SdrViewComponents::Elements::BannerComponent.new(variant: :info) do |component|
|
|
33
|
+
component.with_header { 'Information: For Your Reference' }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def danger
|
|
38
|
+
render SdrViewComponents::Elements::BannerComponent.new(variant: :danger) do |component|
|
|
39
|
+
component.with_header { 'Danger: Critical Alert' }
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
# @!endgroup
|
|
43
|
+
|
|
44
|
+
def with_title
|
|
45
|
+
render SdrViewComponents::Elements::BannerComponent.new(title: 'Subtitle or Additional Title') do |component|
|
|
46
|
+
component.with_header { 'Main Header' }
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def with_header_and_body
|
|
51
|
+
render SdrViewComponents::Elements::BannerComponent.new do |component|
|
|
52
|
+
component.with_header { 'Banner Header' }
|
|
53
|
+
component.with_body { 'This is the body content of the banner, providing additional context or details.' }
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
data/spec/components/previews/sdr_view_components/elements/breadcrumb_nav_component_preview.rb
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class BreadcrumbNavComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Breadcrumb Types
|
|
7
|
+
def default_breadcrumbs
|
|
8
|
+
render SdrViewComponents::Elements::BreadcrumbNavComponent.new do |component|
|
|
9
|
+
component.with_breadcrumb(text: 'Home', link: '/')
|
|
10
|
+
component.with_breadcrumb(text: 'Collections', link: '/collections')
|
|
11
|
+
component.with_breadcrumb(text: 'Current Page', active: true)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def title_breadcrumbs
|
|
16
|
+
render SdrViewComponents::Elements::BreadcrumbNavComponent.new do |component|
|
|
17
|
+
component.with_title_breadcrumb(text: 'Home', link: '/')
|
|
18
|
+
component.with_title_breadcrumb(text: 'A Very Long Title That Will Be Truncated', link: '/titles')
|
|
19
|
+
component.with_title_breadcrumb(text: 'Current Title Item', active: true)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def collection_breadcrumbs
|
|
24
|
+
render SdrViewComponents::Elements::BreadcrumbNavComponent.new do |component|
|
|
25
|
+
component.with_collection_breadcrumb(text: 'Home', link: '/')
|
|
26
|
+
component.with_collection_breadcrumb(text: 'Collection Name Truncated', link: '/collections')
|
|
27
|
+
component.with_collection_breadcrumb(text: 'Item', active: true)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
# @!endgroup
|
|
31
|
+
|
|
32
|
+
# @!group With Links and Active State
|
|
33
|
+
def with_all_links
|
|
34
|
+
render SdrViewComponents::Elements::BreadcrumbNavComponent.new do |component|
|
|
35
|
+
component.with_breadcrumb(text: 'Home', link: '/')
|
|
36
|
+
component.with_breadcrumb(text: 'Section', link: '/section')
|
|
37
|
+
component.with_breadcrumb(text: 'Subsection', link: '/section/subsection')
|
|
38
|
+
component.with_breadcrumb(text: 'Current', active: true)
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def mixed_active_items
|
|
43
|
+
render SdrViewComponents::Elements::BreadcrumbNavComponent.new do |component|
|
|
44
|
+
component.with_breadcrumb(text: 'Home', link: '/')
|
|
45
|
+
component.with_breadcrumb(text: 'Active Section', active: true)
|
|
46
|
+
component.with_breadcrumb(text: 'Another Item', link: '/other')
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
# @!endgroup
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ButtonComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Button Variants
|
|
7
|
+
def primary
|
|
8
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Primary', variant: 'primary')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def secondary
|
|
12
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Secondary', variant: 'secondary')
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def success
|
|
16
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Success', variant: 'success')
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def danger
|
|
20
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Danger', variant: 'danger')
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def warning
|
|
24
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Warning', variant: 'warning')
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def info
|
|
28
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Info', variant: 'info')
|
|
29
|
+
end
|
|
30
|
+
# @!endgroup
|
|
31
|
+
|
|
32
|
+
# @!group Button Sizes
|
|
33
|
+
def small
|
|
34
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Small Button', variant: 'primary', size: 'sm')
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def large
|
|
38
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Large Button', variant: 'primary', size: 'lg')
|
|
39
|
+
end
|
|
40
|
+
# @!endgroup
|
|
41
|
+
|
|
42
|
+
# @!group Borderless
|
|
43
|
+
def borderless
|
|
44
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Borderless Button', variant: 'primary',
|
|
45
|
+
bordered: false)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def borderless_secondary
|
|
49
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Borderless Secondary', variant: 'secondary',
|
|
50
|
+
bordered: false)
|
|
51
|
+
end
|
|
52
|
+
# @!endgroup
|
|
53
|
+
|
|
54
|
+
# @!group Content Options
|
|
55
|
+
def with_label
|
|
56
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Button with Label', variant: 'primary')
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def with_block_content
|
|
60
|
+
render SdrViewComponents::Elements::ButtonComponent.new(variant: 'primary') do
|
|
61
|
+
'Button with Block Content'
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
# @!endgroup
|
|
65
|
+
|
|
66
|
+
def default
|
|
67
|
+
render SdrViewComponents::Elements::ButtonComponent.new(label: 'Default Button')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ButtonFormComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Button Variants
|
|
7
|
+
def primary
|
|
8
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Primary Form Button',
|
|
9
|
+
variant: :primary)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def secondary
|
|
13
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Secondary Form Button',
|
|
14
|
+
variant: :secondary)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def success
|
|
18
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Success Action',
|
|
19
|
+
variant: :success)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def danger
|
|
23
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Delete Item', variant: :danger)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def warning
|
|
27
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Warning Action',
|
|
28
|
+
variant: :warning)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def info
|
|
32
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', label: 'Information Action',
|
|
33
|
+
variant: :info)
|
|
34
|
+
end
|
|
35
|
+
# @!endgroup
|
|
36
|
+
|
|
37
|
+
# @!group With Confirmation
|
|
38
|
+
def with_confirmation
|
|
39
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(
|
|
40
|
+
link: '/delete-item',
|
|
41
|
+
label: 'Delete (with confirmation)',
|
|
42
|
+
variant: :danger,
|
|
43
|
+
confirm: 'Are you sure you want to delete this item?'
|
|
44
|
+
)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def without_confirmation
|
|
48
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(
|
|
49
|
+
link: '/action',
|
|
50
|
+
label: 'Action (no confirmation)',
|
|
51
|
+
variant: :primary
|
|
52
|
+
)
|
|
53
|
+
end
|
|
54
|
+
# @!endgroup
|
|
55
|
+
|
|
56
|
+
# @!group Turbo Frame Behavior
|
|
57
|
+
def turbo_frame_top
|
|
58
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(
|
|
59
|
+
link: '/submit',
|
|
60
|
+
label: 'Submit (reload top)',
|
|
61
|
+
variant: :primary,
|
|
62
|
+
top: true
|
|
63
|
+
)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def turbo_frame_scoped
|
|
67
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(
|
|
68
|
+
link: '/submit',
|
|
69
|
+
label: 'Submit (scoped frame)',
|
|
70
|
+
variant: :primary,
|
|
71
|
+
top: false
|
|
72
|
+
)
|
|
73
|
+
end
|
|
74
|
+
# @!endgroup
|
|
75
|
+
|
|
76
|
+
# @!group Content Options
|
|
77
|
+
def with_label
|
|
78
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(
|
|
79
|
+
link: '/action',
|
|
80
|
+
label: 'Button with Label',
|
|
81
|
+
variant: :primary
|
|
82
|
+
)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def with_block_content
|
|
86
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/action', variant: :primary) do
|
|
87
|
+
'Button with Block Content'
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
# @!endgroup
|
|
91
|
+
|
|
92
|
+
def default
|
|
93
|
+
render SdrViewComponents::Elements::ButtonFormComponent.new(link: '/', label: 'Form Button')
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class ButtonLinkComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Button Variants
|
|
7
|
+
def primary
|
|
8
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Primary Link Button',
|
|
9
|
+
variant: :primary)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def secondary
|
|
13
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Secondary Link Button',
|
|
14
|
+
variant: :secondary)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def success
|
|
18
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Success Link Button',
|
|
19
|
+
variant: :success)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def danger
|
|
23
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Danger Link Button',
|
|
24
|
+
variant: :danger)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def warning
|
|
28
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Warning Link Button',
|
|
29
|
+
variant: :warning)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def info
|
|
33
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Info Link Button',
|
|
34
|
+
variant: :info)
|
|
35
|
+
end
|
|
36
|
+
# @!endgroup
|
|
37
|
+
|
|
38
|
+
# @!group Button Sizes
|
|
39
|
+
def small
|
|
40
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Small Link Button',
|
|
41
|
+
variant: :primary, size: 'sm')
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def large
|
|
45
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Large Link Button',
|
|
46
|
+
variant: :primary, size: 'lg')
|
|
47
|
+
end
|
|
48
|
+
# @!endgroup
|
|
49
|
+
|
|
50
|
+
# @!group Borderless
|
|
51
|
+
def borderless
|
|
52
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Borderless Link Button',
|
|
53
|
+
variant: :primary, bordered: false)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def borderless_secondary
|
|
57
|
+
render SdrViewComponents::Elements::ButtonLinkComponent
|
|
58
|
+
.new(link: '/example',
|
|
59
|
+
label: 'Borderless Secondary Link Button', variant: :secondary, bordered: false)
|
|
60
|
+
end
|
|
61
|
+
# @!endgroup
|
|
62
|
+
|
|
63
|
+
# @!group Content Options
|
|
64
|
+
def with_label
|
|
65
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Label Link Button',
|
|
66
|
+
variant: :primary)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def with_block_content
|
|
70
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', variant: :primary) do
|
|
71
|
+
'Link Button with Block Content'
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
# @!endgroup
|
|
75
|
+
|
|
76
|
+
def default
|
|
77
|
+
render SdrViewComponents::Elements::ButtonLinkComponent.new(link: '/example', label: 'Default Link Button')
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SdrViewComponents
|
|
4
|
+
module Elements
|
|
5
|
+
class CardComponentPreview < ViewComponent::Preview
|
|
6
|
+
# @!group Card Slots
|
|
7
|
+
def default
|
|
8
|
+
render SdrViewComponents::Elements::CardComponent.new
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def with_header
|
|
12
|
+
render SdrViewComponents::Elements::CardComponent.new do |card|
|
|
13
|
+
card.with_header do
|
|
14
|
+
'Card Header'
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def with_body
|
|
20
|
+
render SdrViewComponents::Elements::CardComponent.new do |card|
|
|
21
|
+
card.with_body do
|
|
22
|
+
'Card body content goes here.'
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def with_header_and_body
|
|
28
|
+
render SdrViewComponents::Elements::CardComponent.new do |card|
|
|
29
|
+
card.with_header do
|
|
30
|
+
'Card Header'
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
card.with_body do
|
|
34
|
+
'Card body content goes here.'
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
# @!endgroup
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|