Module: Charming::Generators::AppGenerator::ComponentTemplates

Included in:
Charming::Generators::AppGenerator
Defined in:
lib/charming/generators/app_generator/component_templates.rb

Instance Method Summary collapse

Instance Method Details

#componentObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/charming/generators/app_generator/component_templates.rb', line 7

def component
  %(# frozen_string_literal: true

module #{name.class_name}
  class AppFrameComponent < Charming::Component
    def render
      column(title_line, help_line, gap: 1)
    end
#{component_helpers}
  end
end
)
end

#component_helpersObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/charming/generators/app_generator/component_templates.rb', line 21

def component_helpers
  %(
    private

    def title_line
      text title, style: theme.title
    end

    def help_line
      text "Press p for commands, q to quit.", style: theme.muted
    end)
end