Class: Daisy::Actions::ThemePreviewComponent
- Inherits:
-
LocoMotion::BaseComponent
- Object
- ViewComponent::Base
- LocoMotion::BaseComponent
- Daisy::Actions::ThemePreviewComponent
- Defined in:
- app/components/daisy/actions/theme_preview_component.rb
Constant Summary
Constants inherited from LocoMotion::BaseComponent
LocoMotion::BaseComponent::EMPTY_PART_IGNORED_TAGS, LocoMotion::BaseComponent::SELF_CLOSING_TAGS
Instance Attribute Summary
Attributes inherited from LocoMotion::BaseComponent
Instance Method Summary collapse
-
#before_render ⇒ Object
Sets up the component’s CSS classes and other attributes before rendering.
-
#initialize(theme = nil, **kws, &block) ⇒ ThemePreviewComponent
constructor
Creates a new instance of the ThemePreviewComponent.
-
#setup_component ⇒ Object
Sets up the component’s CSS classes and data attributes.
-
#setup_dots ⇒ Object
Sets up the CSS classes for the theme color dots.
Methods inherited from LocoMotion::BaseComponent
build, #component_ref, #config_option, #cssify, define_modifier, define_modifiers, define_part, define_parts, define_size, define_sizes, #empty_part_content, #inspect, #part, register_component_initializer, register_component_setup, #rendered_css, #rendered_data, #rendered_html, #rendered_stimulus_controllers, #rendered_tag_name, renders_many, renders_one, set_component_name, #set_loco_parent, #strip_spaces
Methods included from LocoMotion::Concerns::InspectableComponent
Constructor Details
#initialize(theme = nil, **kws, &block) ⇒ ThemePreviewComponent
Creates a new instance of the ThemePreviewComponent.
36 37 38 39 40 |
# File 'app/components/daisy/actions/theme_preview_component.rb', line 36 def initialize(theme = nil, **kws, &block) super @theme = config_option(:theme, theme) end |
Instance Method Details
#before_render ⇒ Object
Sets up the component’s CSS classes and other attributes before rendering.
45 46 47 48 |
# File 'app/components/daisy/actions/theme_preview_component.rb', line 45 def before_render setup_component setup_dots end |
#setup_component ⇒ Object
Sets up the component’s CSS classes and data attributes.
53 54 55 56 57 58 59 60 61 |
# File 'app/components/daisy/actions/theme_preview_component.rb', line 53 def setup_component classes = [ "where:size-4 where:grid where:grid-cols-2 where:place-items-center", "where:shrink-0 where:rounded-md where:bg-base-100 where:shadow-sm" ].join(" ") add_css(:component, classes) add_html(:component, { "data-theme": @theme }) end |
#setup_dots ⇒ Object
Sets up the CSS classes for the theme color dots.
66 67 68 69 70 71 |
# File 'app/components/daisy/actions/theme_preview_component.rb', line 66 def setup_dots add_css(:dot_base, "where:bg-base-content where:size-1 where:rounded-full") add_css(:dot_primary, "where:bg-primary where:size-1 where:rounded-full") add_css(:dot_secondary, "where:bg-secondary where:size-1 where:rounded-full") add_css(:dot_accent, "where:bg-accent where:size-1 where:rounded-full") end |