Class: Keystone::Ui::ColorPickerComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/keystone/ui/color_picker_component.rb

Constant Summary collapse

SWATCH_CLASSES =
"w-10 h-10 rounded-lg border border-gray-300 dark:border-zinc-600 cursor-pointer"
PANEL_CLASSES =
"absolute z-50 mt-2 p-3 rounded-lg shadow-lg bg-white dark:bg-zinc-800 border border-gray-200 dark:border-zinc-700 hidden"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, value: "#000000", label: nil) ⇒ ColorPickerComponent

Returns a new instance of ColorPickerComponent.



12
13
14
15
16
# File 'app/components/keystone/ui/color_picker_component.rb', line 12

def initialize(name:, value: "#000000", label: nil)
  @name = name
  @value = value
  @label = label
end

Instance Attribute Details

#labelObject (readonly)

Returns the value of attribute label.



10
11
12
# File 'app/components/keystone/ui/color_picker_component.rb', line 10

def label
  @label
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'app/components/keystone/ui/color_picker_component.rb', line 10

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



10
11
12
# File 'app/components/keystone/ui/color_picker_component.rb', line 10

def value
  @value
end

Instance Method Details

#controller_nameObject



18
19
20
# File 'app/components/keystone/ui/color_picker_component.rb', line 18

def controller_name
  "color-picker"
end

#panel_classesObject



26
27
28
# File 'app/components/keystone/ui/color_picker_component.rb', line 26

def panel_classes
  PANEL_CLASSES
end

#swatch_classesObject



22
23
24
# File 'app/components/keystone/ui/color_picker_component.rb', line 22

def swatch_classes
  SWATCH_CLASSES
end