ccs-frontend_helpers 0.1.0.rc.1 → 0.1.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -1
  3. data/.ruby-version +1 -0
  4. data/CHANGELOG.md +4 -1
  5. data/Gemfile.lock +71 -71
  6. data/lib/ccs/components/base.rb +64 -0
  7. data/lib/ccs/components/ccs/dashboard_section/panel.rb +55 -0
  8. data/lib/ccs/components/ccs/dashboard_section.rb +71 -0
  9. data/lib/ccs/components/ccs/footer/link.rb +53 -0
  10. data/lib/ccs/components/ccs/footer/meta.rb +58 -0
  11. data/lib/ccs/components/ccs/footer/navigation.rb +59 -0
  12. data/lib/ccs/components/ccs/footer.rb +93 -0
  13. data/lib/ccs/components/ccs/header/link.rb +58 -0
  14. data/lib/ccs/components/ccs/header/navigation.rb +97 -0
  15. data/lib/ccs/components/ccs/header/service_authentication.rb +52 -0
  16. data/lib/ccs/components/ccs/header.rb +108 -0
  17. data/lib/ccs/components/ccs/logo.rb +45 -0
  18. data/lib/ccs/components/govuk/accordion/section/content.rb +53 -0
  19. data/lib/ccs/components/govuk/accordion/section/header.rb +57 -0
  20. data/lib/ccs/components/govuk/accordion/section.rb +60 -0
  21. data/lib/ccs/components/govuk/accordion.rb +56 -0
  22. data/lib/ccs/components/govuk/back_link.rb +49 -0
  23. data/lib/ccs/components/govuk/breadcrumbs/link.rb +55 -0
  24. data/lib/ccs/components/govuk/breadcrumbs.rb +53 -0
  25. data/lib/ccs/components/govuk/button.rb +105 -0
  26. data/lib/ccs/components/govuk/cookie_banner/action.rb +58 -0
  27. data/lib/ccs/components/govuk/cookie_banner/message.rb +78 -0
  28. data/lib/ccs/components/govuk/cookie_banner.rb +53 -0
  29. data/lib/ccs/components/govuk/details.rb +51 -0
  30. data/lib/ccs/components/govuk/error_message.rb +58 -0
  31. data/lib/ccs/components/govuk/error_summary/item.rb +52 -0
  32. data/lib/ccs/components/govuk/error_summary.rb +68 -0
  33. data/lib/ccs/components/govuk/field/input/character_count.rb +127 -0
  34. data/lib/ccs/components/govuk/field/input/file_upload.rb +42 -0
  35. data/lib/ccs/components/govuk/field/input/select.rb +80 -0
  36. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +53 -0
  37. data/lib/ccs/components/govuk/field/input/text_input.rb +95 -0
  38. data/lib/ccs/components/govuk/field/input/textarea.rb +57 -0
  39. data/lib/ccs/components/govuk/field/input.rb +60 -0
  40. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +67 -0
  41. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +63 -0
  42. data/lib/ccs/components/govuk/field/inputs/date_input.rb +87 -0
  43. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +45 -0
  44. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +41 -0
  45. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +48 -0
  46. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +48 -0
  47. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +42 -0
  48. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +41 -0
  49. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +48 -0
  50. data/lib/ccs/components/govuk/field/inputs/item.rb +109 -0
  51. data/lib/ccs/components/govuk/field/inputs/radios.rb +67 -0
  52. data/lib/ccs/components/govuk/field/inputs.rb +55 -0
  53. data/lib/ccs/components/govuk/field.rb +106 -0
  54. data/lib/ccs/components/govuk/fieldset/legend.rb +63 -0
  55. data/lib/ccs/components/govuk/fieldset.rb +52 -0
  56. data/lib/ccs/components/govuk/footer/link.rb +53 -0
  57. data/lib/ccs/components/govuk/footer/meta.rb +58 -0
  58. data/lib/ccs/components/govuk/footer/navigation.rb +59 -0
  59. data/lib/ccs/components/govuk/footer.rb +129 -0
  60. data/lib/ccs/components/govuk/form_group.rb +58 -0
  61. data/lib/ccs/components/govuk/header/link.rb +54 -0
  62. data/lib/ccs/components/govuk/header/navigation.rb +70 -0
  63. data/lib/ccs/components/govuk/header.rb +105 -0
  64. data/lib/ccs/components/govuk/hint.rb +47 -0
  65. data/lib/ccs/components/govuk/inset_text.rb +50 -0
  66. data/lib/ccs/components/govuk/label.rb +83 -0
  67. data/lib/ccs/components/govuk/notification_banner.rb +105 -0
  68. data/lib/ccs/components/govuk/pagination/increment/next.rb +42 -0
  69. data/lib/ccs/components/govuk/pagination/increment/previous.rb +41 -0
  70. data/lib/ccs/components/govuk/pagination/increment.rb +96 -0
  71. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +26 -0
  72. data/lib/ccs/components/govuk/pagination/item/form.rb +47 -0
  73. data/lib/ccs/components/govuk/pagination/item/tag.rb +45 -0
  74. data/lib/ccs/components/govuk/pagination/item.rb +62 -0
  75. data/lib/ccs/components/govuk/pagination.rb +94 -0
  76. data/lib/ccs/components/govuk/panel.rb +60 -0
  77. data/lib/ccs/components/govuk/phase_banner.rb +67 -0
  78. data/lib/ccs/components/govuk/skip_link.rb +49 -0
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +51 -0
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +48 -0
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +43 -0
  82. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +61 -0
  83. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +67 -0
  84. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +54 -0
  85. data/lib/ccs/components/govuk/step_by_step_navigation.rb +57 -0
  86. data/lib/ccs/components/govuk/summary_list/action/link.rb +57 -0
  87. data/lib/ccs/components/govuk/summary_list/card/actions.rb +57 -0
  88. data/lib/ccs/components/govuk/summary_list/card/title.rb +49 -0
  89. data/lib/ccs/components/govuk/summary_list/card.rb +61 -0
  90. data/lib/ccs/components/govuk/summary_list/row/actions.rb +57 -0
  91. data/lib/ccs/components/govuk/summary_list/row/key.rb +45 -0
  92. data/lib/ccs/components/govuk/summary_list/row/value.rb +45 -0
  93. data/lib/ccs/components/govuk/summary_list/row.rb +63 -0
  94. data/lib/ccs/components/govuk/summary_list.rb +72 -0
  95. data/lib/ccs/components/govuk/table/body/data_cell.rb +51 -0
  96. data/lib/ccs/components/govuk/table/body/head_cell.rb +50 -0
  97. data/lib/ccs/components/govuk/table/header/head_cell.rb +52 -0
  98. data/lib/ccs/components/govuk/table.rb +109 -0
  99. data/lib/ccs/components/govuk/tabs/panel.rb +56 -0
  100. data/lib/ccs/components/govuk/tabs/tab.rb +54 -0
  101. data/lib/ccs/components/govuk/tabs.rb +64 -0
  102. data/lib/ccs/components/govuk/tag.rb +49 -0
  103. data/lib/ccs/components/govuk/warning_text.rb +59 -0
  104. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +25 -0
  105. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +16 -131
  106. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +16 -195
  107. data/lib/ccs/frontend_helpers/ccs_frontend.rb +2 -4
  108. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +16 -105
  109. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +16 -29
  110. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +16 -66
  111. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +16 -117
  112. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +26 -0
  113. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +26 -0
  114. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +16 -126
  115. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +26 -0
  116. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +18 -36
  117. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +31 -54
  118. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +32 -86
  119. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +18 -61
  120. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +26 -0
  121. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +16 -173
  122. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +26 -39
  123. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +16 -151
  124. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +17 -28
  125. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +26 -0
  126. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +18 -34
  127. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +17 -82
  128. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +18 -126
  129. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +16 -326
  130. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +18 -41
  131. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +18 -39
  132. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +26 -0
  133. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +26 -0
  134. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +16 -30
  135. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +23 -204
  136. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +16 -216
  137. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +16 -114
  138. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +16 -85
  139. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +16 -32
  140. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +26 -0
  141. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +18 -43
  142. data/lib/ccs/frontend_helpers/govuk_frontend.rb +17 -19
  143. data/lib/ccs/frontend_helpers/version.rb +1 -1
  144. metadata +110 -14
  145. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_panels.rb +0 -79
  146. data/lib/ccs/frontend_helpers/ccs_frontend/logo.rb +0 -49
  147. data/lib/ccs/frontend_helpers/govuk_frontend/field/character_count.rb +0 -165
  148. data/lib/ccs/frontend_helpers/govuk_frontend/field/checkboxes.rb +0 -200
  149. data/lib/ccs/frontend_helpers/govuk_frontend/field/date_input.rb +0 -153
  150. data/lib/ccs/frontend_helpers/govuk_frontend/field/file_upload.rb +0 -83
  151. data/lib/ccs/frontend_helpers/govuk_frontend/field/input.rb +0 -153
  152. data/lib/ccs/frontend_helpers/govuk_frontend/field/radios.rb +0 -201
  153. data/lib/ccs/frontend_helpers/govuk_frontend/field/select.rb +0 -124
  154. data/lib/ccs/frontend_helpers/govuk_frontend/field/textarea.rb +0 -106
  155. data/lib/ccs/frontend_helpers/govuk_frontend/field.rb +0 -213
  156. data/lib/ccs/frontend_helpers/shared_methods.rb +0 -27
@@ -0,0 +1,93 @@
1
+ require_relative '../base'
2
+ require_relative 'logo'
3
+ require_relative 'footer/navigation'
4
+ require_relative 'footer/meta'
5
+
6
+ module CCS::Components
7
+ module CCS
8
+ # = CCS Footer
9
+ #
10
+ # This is used for generating the footer component from the
11
+ # {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/footer CCS - Components - Footer}
12
+ #
13
+ # @!attribute [r] navigation
14
+ # @return [Array<Navigation>] An array of the initialised navigation sections
15
+ # @!attribute [r] meta
16
+ # @return [Meta] The initialised meta section
17
+
18
+ class Footer < Base
19
+ private
20
+
21
+ attr_reader :navigation, :meta
22
+
23
+ public
24
+
25
+ # @param navigation [Array<Hash>] an array of sections for the footer navigation.
26
+ # See {Components::CCS::Footer::Navigation#initialize Navigation#initialize} for details of the items in the array.
27
+ # @param meta [Hash] ptions for the meta section of the footer.
28
+ # See {Components::CCS::Footer::Meta#initialize Meta#initialize} for details of the options.
29
+ # @param options [Hash] options that will be used in customising the HTML
30
+ #
31
+ # @option options [String] :classes additional CSS classes for the footer HTML
32
+ # @option options [String] :container_class classes that can be added to the inner container
33
+ # @option options [ActiveSupport::SafeBuffer,String] :copyright The copyright information, (default: '© Crown copyright')
34
+ # @option options [Hash] :attributes additional attributes that will added as part of the HTML
35
+
36
+ def initialize(navigation: nil, meta: nil, **options)
37
+ super(**options)
38
+
39
+ @options[:attributes][:role] = 'contentinfo'
40
+ @options[:copyright] ||= '© Crown copyright'
41
+
42
+ @navigation = navigation&.map { |navigation_item| Navigation.new(context: @context, **navigation_item) }
43
+ @meta = Meta.new(context: @context, **meta) if meta
44
+ end
45
+
46
+ # rubocop:disable Metrics/AbcSize
47
+
48
+ # Generates the HTML for the CCS Footer component
49
+ #
50
+ # @return [ActiveSupport::SafeBuffer]
51
+
52
+ def render
53
+ tag.footer(**options[:attributes]) do
54
+ tag.div(class: "govuk-width-container #{options[:container_classes]}".rstrip) do
55
+ if navigation
56
+ concat(tag.div(class: 'ccs-footer__navigation') do
57
+ navigation.each { |navigation_item| concat(navigation_item.render) }
58
+ end)
59
+ concat(tag.hr(class: 'ccs-footer__section-break'))
60
+ end
61
+ concat(tag.div(class: 'ccs-footer__meta') do
62
+ concat(tag.div(class: 'ccs-footer__meta-item') do
63
+ concat(tag.div(Logo.render, class: 'ccs-footer__logo'))
64
+ concat(footer_copyright)
65
+ end)
66
+ concat(tag.div(class: 'ccs-footer__meta-item ccs-footer__meta-item--grow') do
67
+ concat(meta.render) if meta
68
+ end)
69
+ end)
70
+ end
71
+ end
72
+ end
73
+
74
+ # rubocop:enable Metrics/AbcSize
75
+
76
+ # The default attributes for the breadcrumbs
77
+
78
+ DEFAULT_ATTRIBUTES = { class: 'ccs-footer' }.freeze
79
+
80
+ private
81
+
82
+ # Generates the copyright used in the footer
83
+ #
84
+ # @return [ActiveSupport::SafeBuffer]
85
+
86
+ def footer_copyright
87
+ tag.div(class: 'ccs-footer__copyright') do
88
+ link_to(options[:copyright], 'https://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/', class: 'ccs-footer__link')
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,58 @@
1
+ require_relative '../../base'
2
+
3
+ module CCS::Components
4
+ module CCS
5
+ class Header < Base
6
+ # = CCS Header link
7
+ #
8
+ # The individual header link item
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the header link
12
+ # @!attribute [r] li_class
13
+ # @return [String] The class for the li elements
14
+ # @!attribute [r] href
15
+ # @return [String] The href for the header link
16
+
17
+ class Link < Base
18
+ private
19
+
20
+ attr_reader :text, :li_class, :href
21
+
22
+ public
23
+
24
+ # @param text [String] the text for the header link
25
+ # @param li_class [String] class for the li elements
26
+ # @param href [String] the href for the header link
27
+ # @param options [Hash] options that will be used in customising the HTML
28
+ #
29
+ # @option options [Boolean] :active flag to mark the navigation item as active or not
30
+ # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
31
+
32
+ def initialize(text:, li_class:, href: nil, **options)
33
+ super(**options)
34
+
35
+ @text = text
36
+ @href = href
37
+ @li_class = li_class
38
+ end
39
+
40
+ # Generates the HTML for the CCS Header link
41
+ #
42
+ # @return [ActiveSupport::SafeBuffer]
43
+
44
+ def render
45
+ tag.li(class: "#{li_class} #{'ccs-header__navigation-item--active' if options[:active]}".rstrip) do
46
+ if href
47
+ options[:attributes][:class] = 'ccs-header__link'
48
+
49
+ link_to(text, href, **options[:attributes])
50
+ else
51
+ text
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,97 @@
1
+ require_relative '../../base'
2
+ require_relative 'link'
3
+
4
+ module CCS::Components
5
+ module CCS
6
+ class Header < Base
7
+ # = CCS Header navigation
8
+ #
9
+ # The header navigation section
10
+ #
11
+ # @!attribute [r] primary_links
12
+ # @return [Array<Link>] An array of the initialised primary navigation links
13
+ # @!attribute [r] secondary_links
14
+ # @return [Array<Link>] An array of the initialised secondary navigation links
15
+ # @!attribute [r] navigation_label
16
+ # @return [String] The aria label for the navigation
17
+ # @!attribute [r] navigation_classes
18
+ # @return [String] The classes for the navigation
19
+ # @!attribute [r] menu_button
20
+ # @return [Hash] The options for the menu button
21
+
22
+ class Navigation
23
+ include ActionView::Context
24
+ include ActionView::Helpers
25
+
26
+ private
27
+
28
+ attr_reader :primary_links, :secondary_links, :navigation_label, :navigation_classes, :menu_button
29
+
30
+ public
31
+
32
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
33
+
34
+ # @param navigation [Hash] options for the navigation
35
+ # @param menu_button [Hash] options for the menu button
36
+ # @param context [ActionView::Base] the view context
37
+ #
38
+ # @option navigation [Array] :primary_items an array of primary links for the navigation section.
39
+ # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
40
+ # @option navigation [Array] :secondary_items an array of secondary links for the navigation section.
41
+ # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
42
+ # @option navigation [String] :classes additional CSS classes for the navigation HTML
43
+ # @option navigation [String] :label text for the aria-label attribute of the navigation. Defaults to the menu button text
44
+ #
45
+ # @option menu_button [String] :text text for the button that opens the mobile navigation menu.
46
+ # By default, this is set to +Menu+.
47
+ # @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
48
+ # Defaults to +Show or hide menu+.
49
+
50
+ def initialize(navigation:, serivce_name_present:, context:, menu_button: nil)
51
+ menu_button ||= {}
52
+ menu_button[:text] ||= 'Menu'
53
+ menu_button[:label] ||= 'Show or hide menu'
54
+
55
+ @menu_button = menu_button
56
+ @primary_links = navigation[:primary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
57
+ @secondary_links = navigation[:secondary_items]&.map { |navigation_link| Link.new(li_class: LI_CLASS, context: context, **navigation_link) }
58
+ @navigation_label = navigation[:label] || menu_button[:text]
59
+ @navigation_classes = "ccs-header__navigation #{navigation[:classes]}".rstrip
60
+ @navigation_classes << ' ccs-header__navigation--no-service-name' unless serivce_name_present
61
+ end
62
+
63
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
64
+
65
+ # rubocop:disable Metrics/AbcSize
66
+
67
+ # Generates the HTML for the GOV.UK Navigation
68
+ #
69
+ # @return [ActiveSupport::SafeBuffer]
70
+
71
+ def render
72
+ tag.nav(aria: { label: navigation_label }, class: navigation_classes) do
73
+ concat(button_tag(menu_button[:text], type: :button, class: 'ccs-header__menu-button ccs-js-header-toggle', aria: { controls: 'navigation', label: menu_button[:label] }, hidden: true))
74
+ concat(tag.div(id: 'navigation', class: 'ccs-header__navigation-lists') do
75
+ if secondary_links
76
+ concat(tag.ul(id: 'navigation-secondary', class: "ccs-header__navigation-secondary-list #{'ccs-header__navigation--no-second-list' unless primary_links}".rstrip) do
77
+ secondary_links.each { |secondary_link| concat(secondary_link.render) }
78
+ end)
79
+ end
80
+ if primary_links
81
+ concat(tag.ul(id: 'navigation-primary', class: "ccs-header__navigation-primary-list #{'ccs-header__navigation--no-second-list' unless secondary_links}".rstrip) do
82
+ primary_links.each { |primary_link| concat(primary_link.render) }
83
+ end)
84
+ end
85
+ end)
86
+ end
87
+ end
88
+
89
+ # rubocop:enable Metrics/AbcSize
90
+
91
+ # The li class for the navigation links
92
+
93
+ LI_CLASS = 'ccs-header__navigation-item'.freeze
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,52 @@
1
+ require_relative '../../base'
2
+ require_relative 'link'
3
+
4
+ module CCS::Components
5
+ module CCS
6
+ class Header < Base
7
+ # = CCS Header Service Authentication
8
+ #
9
+ # The individual footer navigation item
10
+ #
11
+ # @!attribute [r] service_authentication_links
12
+ # @return [Array<Link>] An array of the initialised service authentication links
13
+ # @!attribute [r] container_classes
14
+ # @return [String] classes for the container
15
+
16
+ class ServiceAuthentication
17
+ include ActionView::Context
18
+ include ActionView::Helpers
19
+
20
+ private
21
+
22
+ attr_reader :service_authentication_links, :container_classes
23
+
24
+ public
25
+
26
+ # @param service_authentication_items [Array<Hash>] an array of links for the service authentication section.
27
+ # See {Components::CCS::Header::Link#initialize Link#initialize} for details of the items in the array.
28
+ # @param container_classes [String] classes for the container
29
+ # @param context [ActionView::Base] the view context
30
+
31
+ def initialize(service_authentication_items:, context:, container_classes: nil)
32
+ @service_authentication_links = service_authentication_items&.map { |service_authentication_link| Link.new(li_class: 'ccs-header__service-authentication-item', active: false, context: context, **service_authentication_link) }
33
+ @container_classes = container_classes
34
+ end
35
+
36
+ # Generates the HTML for the CCS Footer Meta sections
37
+ #
38
+ # @return [ActiveSupport::SafeBuffer]
39
+
40
+ def render
41
+ tag.div(class: 'ccs-header__service-authentication') do
42
+ tag.div(class: "ccs-header__service-authentication-container #{container_classes}".rstrip) do
43
+ tag.ul(class: 'ccs-header__service-authentication-list') do
44
+ service_authentication_links.each { |service_authentication_link| concat(service_authentication_link.render) }
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,108 @@
1
+ require_relative '../base'
2
+ require_relative 'logo'
3
+ require_relative 'header/service_authentication'
4
+ require_relative 'header/navigation'
5
+
6
+ module CCS::Components
7
+ module CCS
8
+ # = CCS Header
9
+ #
10
+ # This is used for generating the header component from the
11
+ # {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/header CCS - Components - Header}
12
+ #
13
+ # @!attribute [r] service_authentication
14
+ # @return [ServiceAuthentication] The initialised service authentication section
15
+ # @!attribute [r] navigation
16
+ # @return [Navigation] The initialised navigation section
17
+ # @!attribute [r] service
18
+ # @return [Hash] The options for the service section
19
+
20
+ class Header < Base
21
+ private
22
+
23
+ attr_reader :service_authentication, :navigation, :service
24
+
25
+ public
26
+
27
+ # @param service_authentication_items [Array<Hash>] An array of links for the service authentication section of the header.
28
+ # See {Components::CCS::Header::ServiceAuthentication#initialize ServiceAuthentication#initialize} for details of the items in the array.
29
+ # @param navigation [Hash] options for the navigation section of the header.
30
+ # See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
31
+ # @param menu_button [Hash] options for the menu button in the header.
32
+ # See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
33
+ # @param service [Hash] options for the service name
34
+ # @param options [Hash] options that will be used in customising the HTML
35
+ #
36
+ # @option service [String] :name the name of the service, included in the header
37
+ # @option service [String] :href URL for the service name anchor
38
+ #
39
+ # @option options [String] :classes additional CSS classes for the header HTML
40
+ # @option options [String] :container_classes classes for the container
41
+ # @option options [String] :homepage_url URL of the homepage. Defaults to +/https://www.crowncommercial.gov.uk+
42
+ # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
43
+
44
+ def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **options)
45
+ super(**options)
46
+
47
+ @options[:attributes][:role] = 'banner'
48
+ @options[:container_classes] ||= 'govuk-width-container'
49
+ @options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
50
+
51
+ @service_authentication = ServiceAuthentication.new(service_authentication_items: service_authentication_items, container_classes: @options[:container_classes], context: @context) if service_authentication_items
52
+ @navigation = Navigation.new(navigation: navigation, serivce_name_present: service, menu_button: menu_button, context: @context) if navigation
53
+ @service = service
54
+ end
55
+
56
+ # rubocop:disable Metrics/AbcSize
57
+
58
+ # Generates the HTML for the CCS Header component
59
+ #
60
+ # @return [ActiveSupport::SafeBuffer]
61
+
62
+ def render
63
+ tag.header(**options[:attributes]) do
64
+ concat(service_authentication.render) if service_authentication
65
+ concat(tag.div(class: "ccs-header__container #{options[:container_classes]}".rstrip) do
66
+ concat(header_logo)
67
+ if service || navigation
68
+ concat(tag.div(class: 'ccs-header__content') do
69
+ concat(header_service_name) if service
70
+ concat(navigation.render) if navigation
71
+ end)
72
+ end
73
+ end)
74
+ end
75
+ end
76
+
77
+ # rubocop:enable Metrics/AbcSize
78
+
79
+ # The default attributes for the breadcrumbs
80
+
81
+ DEFAULT_ATTRIBUTES = { class: 'ccs-header', data: { module: 'ccs-header' } }.freeze
82
+
83
+ private
84
+
85
+ # Generates the logo for header
86
+ #
87
+ # @return [ActiveSupport::SafeBuffer]
88
+
89
+ def header_logo
90
+ tag.div(class: 'ccs-header__logo') do
91
+ link_to(Logo.render, options[:homepage_url], class: 'ccs-header__link ccs-header__link--homepage', aria: { label: 'Crown Commercial Service' })
92
+ end
93
+ end
94
+
95
+ # Generates the service name section
96
+ #
97
+ # @return [ActiveSupport::SafeBuffer]
98
+
99
+ def header_service_name
100
+ if service[:href]
101
+ link_to(service[:name], service[:href], class: 'ccs-header__link ccs-header__link--service-name')
102
+ else
103
+ tag.span(service[:name], class: 'ccs-header__link--service-name')
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,45 @@
1
+ require 'action_view'
2
+
3
+ module CCS::Components
4
+ module CCS
5
+ # = CCS Logo
6
+ #
7
+ # This is used for generating the logo component from the
8
+ # {https://github.com/tim-s-ccs/ts-ccs-frontend/tree/main/src/ccs/components/logo CCS - Components - Logo}
9
+
10
+ class Logo
11
+ extend ActionView::Context
12
+ extend ActionView::Helpers
13
+
14
+ # Generates the HTML for the CCS Logo.
15
+ # Used in {CCS::Components::CCS::Header Header} and {CCS::Components::CCS::Footer Footer}
16
+ #
17
+ # @return [ActiveSupport::SafeBuffer]
18
+
19
+ def self.render
20
+ tag.span(class: 'ccs-logo') do
21
+ concat(tag.svg(class: 'ccs-logo__svg', xmlns: 'http://www.w3.org/2000/svg', height: '101', width: '121', aria: { hidden: 'true' }, focusable: 'false', viewBox: '0 0 121 101') do
22
+ CCS_LOGO_PATHS.each { |ccs_logo_path_attributes| concat(tag.path(**ccs_logo_path_attributes)) }
23
+ end)
24
+ concat(tag.span('Crown Commercial Service', class: 'ccs-logo__text', hidden: true))
25
+ end
26
+ end
27
+
28
+ # Array of the SVG paths for the CCS Logo
29
+
30
+ CCS_LOGO_PATHS = [
31
+ {
32
+ fill: 'currentColor',
33
+ 'fill-rule': 'evenodd',
34
+ d: 'M1.9.4H0v99.8h1.9V.4zm20 43c-.4-2.2-2.1-3.3-4.3-3.3-3.7 0-5.3 3-5.3 6.3 0 3.6 1.6 6.6 5.3 6.6 2.7 0 4.3-2 4.5-4.5h2c-.3 3.9-2.8 6.2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CS::Components
4
+ module GovUK
5
+ class Accordion < Base
6
+ class Section
7
+ # = GOV.UK Accordion Section Content
8
+ #
9
+ # The individual accordion section content
10
+ #
11
+ # @!attribute [r] section
12
+ # @return [Hash] Attributes for the accordion section
13
+ # @!attribute [r] accordion_id
14
+ # @return [String] ID of the accordion
15
+ # @!attribute [r] index
16
+ # @return [Integer] Index of the accordion section
17
+
18
+ class Content
19
+ include ActionView::Context
20
+ include ActionView::Helpers
21
+
22
+ private
23
+
24
+ attr_reader :section, :accordion_id, :index
25
+
26
+ public
27
+
28
+ # @param section [Hash] attributes for the accordion section
29
+ # @param accordion_id [String] ID of the accordion
30
+ # @param index [Integer] the index of the accordion section
31
+ #
32
+ # @option (see CCS::Components::GovUK::Accordion::Section)
33
+
34
+ def initialize(section:, accordion_id:, index:)
35
+ @section = section
36
+ @accordion_id = accordion_id
37
+ @index = index
38
+ end
39
+
40
+ # Generates the HTML for the GOV.UK Accordion Section Content
41
+ #
42
+ # @return [ActiveSupport::SafeBuffer]
43
+
44
+ def render
45
+ tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}", aria: { labelledby: "#{accordion_id}-heading-#{index}" }) do
46
+ section[:content] || tag.p(section[:text], class: 'govuk-body')
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,57 @@
1
+ require_relative '../../../base'
2
+
3
+ module CCS::Components
4
+ module GovUK
5
+ class Accordion < Base
6
+ class Section
7
+ # = GOV.UK Accordion Section Header
8
+ #
9
+ # The individual accordion section header
10
+ #
11
+ # @!attribute [r] section
12
+ # @return [Hash] Attributes for the accordion section
13
+ # @!attribute [r] accordion_id
14
+ # @return [String] ID of the accordion
15
+ # @!attribute [r] index
16
+ # @return [Integer] Index of the accordion section
17
+ # @!attribute [r] heading_level
18
+ # @return [Integer] The heading level for the accordion section
19
+
20
+ class Header
21
+ include ActionView::Context
22
+ include ActionView::Helpers
23
+
24
+ private
25
+
26
+ attr_reader :section, :accordion_id, :index, :heading_level
27
+
28
+ public
29
+
30
+ # @param (see CCS::Components::GovUK::Accordion::Section)
31
+ #
32
+ # @option (see CCS::Components::GovUK::Accordion::Section)
33
+
34
+ def initialize(section:, accordion_id:, index:, heading_level:)
35
+ @section = section
36
+ @accordion_id = accordion_id
37
+ @index = index
38
+ @heading_level = heading_level
39
+ end
40
+
41
+ # Generates the HTML for the GOV.UK Accordion Section Header
42
+ #
43
+ # @return [ActiveSupport::SafeBuffer]
44
+
45
+ def render
46
+ tag.div(class: 'govuk-accordion__section-header') do
47
+ concat(tag.send("h#{heading_level}", class: 'govuk-accordion__section-heading') do
48
+ tag.span(section[:heading], class: 'govuk-accordion__section-button', id: "#{accordion_id}-heading-#{index}")
49
+ end)
50
+ concat(tag.div(section[:summary], class: 'govuk-accordion__section-summary govuk-body', id: "#{accordion_id}-summary-#{index}")) if section[:summary]
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,60 @@
1
+ require_relative '../../base'
2
+ require_relative 'section/header'
3
+ require_relative 'section/content'
4
+
5
+ module CCS::Components
6
+ module GovUK
7
+ class Accordion < Base
8
+ # = GOV.UK Accordion Section
9
+ #
10
+ # The individual accordion section
11
+ #
12
+ # @!attribute [r] header
13
+ # @return [Header] Initialised accordion section header
14
+ # @!attribute [r] content
15
+ # @return [Content] Initialised accordion section content
16
+ # @!attribute [r] section_is_expanded
17
+ # @return [Boolean] flag to indicate of the section should be expanded
18
+
19
+ class Section
20
+ include ActionView::Context
21
+ include ActionView::Helpers
22
+
23
+ private
24
+
25
+ attr_reader :header, :content, :section_is_expanded
26
+
27
+ public
28
+
29
+ # @param section [Hash] attributes for the accordion section
30
+ # @param accordion_id [String] ID of the accordion
31
+ # @param index [Integer] the index of the accordion section
32
+ # @param heading_level [Integer] heading level, from 1 to 6
33
+ #
34
+ # @option section [Boolean] :expanded sets whether the section should be expanded
35
+ # when the page loads for the first time.
36
+ # @option section [String] :heading the heading text for the accordion
37
+ # @option section [String] :summary (nil) optional summary text for the accordion header
38
+ # @option section [ActiveSupport::SafeBuffer] :content the content within the accordion section
39
+ # @option section [String] : text if +:content+ is +nil+ then the text will be rendered
40
+
41
+ def initialize(section:, accordion_id:, index:, heading_level:)
42
+ @section_is_expanded = section[:expanded]
43
+ @header = Header.new(section: section, accordion_id: accordion_id, index: index, heading_level: heading_level)
44
+ @content = Content.new(section: section, accordion_id: accordion_id, index: index)
45
+ end
46
+
47
+ # Generates the HTML for the GOV.UK Accordion Section
48
+ #
49
+ # @return [ActiveSupport::SafeBuffer]
50
+
51
+ def render
52
+ tag.div(class: "govuk-accordion__section #{'govuk-accordion__section--expanded' if section_is_expanded}".rstrip) do
53
+ concat(header.render)
54
+ concat(content.render)
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end