Module: ReactOnRails::Generators::DemoPageConfig

Included in:
ReactNoReduxGenerator, ReactWithReduxGenerator, RscSetup
Defined in:
lib/generators/react_on_rails/demo_page_config.rb

Overview

rubocop:disable Metrics/ModuleLength

Instance Method Summary collapse

Instance Method Details

#build_hello_server_view_config(landing_page:, redux_demo:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/generators/react_on_rails/demo_page_config.rb', line 18

def build_hello_server_view_config(landing_page:, redux_demo:)
  {
    title: "React Server Components Demo",
    intro: "This route shows the Pro React Server Components flow: Rails streams an async server " \
           "component response while only client islands ship JavaScript to the browser.",
    highlights: hello_server_highlights,
    file_hints: hello_server_file_hints,
    quick_links: hello_server_quick_links(landing_page: landing_page, redux_demo: redux_demo),
    learning_links: hello_server_learning_links
  }
end

#build_hello_world_view_config(component_name:, source_path:, landing_page:, redux:, rsc_demo:) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/generators/react_on_rails/demo_page_config.rb', line 6

def build_hello_world_view_config(component_name:, source_path:, landing_page:, redux:, rsc_demo:)
  {
    component_name: component_name,
    title: redux ? "Redux SSR Demo" : "React SSR Demo",
    intro: hello_world_intro(redux: redux),
    highlights: hello_world_highlights(redux: redux),
    file_hints: hello_world_file_hints(source_path: source_path, redux: redux),
    quick_links: hello_world_quick_links(landing_page: landing_page, rsc_demo: rsc_demo),
    learning_links: hello_world_learning_links
  }
end