Sha256: dbca2a3ecaec748f45ab8de1b0fa5cdcd115e82550b2e89855cd6900f96f8e60

Contents?: true

Size: 937 Bytes

Versions: 2

Compression:

Stored size: 937 Bytes

Contents

require_relative 'todo_input'

class NewTodoInput < TodoInput
  option :presenter
  
  markup { # evaluated against instance as a smart convention
    input(placeholder: "What needs to be done?", autofocus: "") {
      value <=> [presenter.new_todo, :task]
    
      onkeyup do |event|
        presenter.create_todo if event.key == 'Enter' || event.keyCode == "\r"
      end
    }
  }
  
  style { # evaluated against class as a smart convention (common to all instances)
    todo_input_styles
    
    rule(".#{component_element_class}") { # NewTodoInput has component_element_class as 'new-todo-input'
      padding '16px 16px 16px 60px'
      height '65px'
      border 'none'
      background 'rgba(0, 0, 0, 0.003)'
      box_shadow 'inset 0 -2px 1px rgba(0,0,0,0.03)'
    }
    
    rule(".#{component_element_class}::placeholder") {
      font_style 'italic'
      font_weight '400'
      color 'rgba(0, 0, 0, 0.4)'
    }
  }
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
glimmer-dsl-web-0.4.2 lib/glimmer-dsl-web/samples/regular/todo_mvc/views/new_todo_input.rb
glimmer-dsl-web-0.4.1 lib/glimmer-dsl-web/samples/regular/todo_mvc/views/new_todo_input.rb