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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/Gemfile.lock +1 -1
  4. data/lib/ccs/components/ccs/dashboard_section/panel.rb +43 -41
  5. data/lib/ccs/components/ccs/dashboard_section.rb +50 -48
  6. data/lib/ccs/components/ccs/footer/link.rb +41 -39
  7. data/lib/ccs/components/ccs/footer/meta.rb +49 -48
  8. data/lib/ccs/components/ccs/footer/navigation.rb +51 -50
  9. data/lib/ccs/components/ccs/footer.rb +69 -67
  10. data/lib/ccs/components/ccs/header/link.rb +47 -45
  11. data/lib/ccs/components/ccs/header/navigation.rb +85 -84
  12. data/lib/ccs/components/ccs/header/service_authentication.rb +35 -34
  13. data/lib/ccs/components/ccs/header.rb +87 -85
  14. data/lib/ccs/components/ccs/logo.rb +36 -34
  15. data/lib/ccs/components/govuk/accordion/section/content.rb +42 -42
  16. data/lib/ccs/components/govuk/accordion/section/header.rb +48 -48
  17. data/lib/ccs/components/govuk/accordion/section.rb +49 -48
  18. data/lib/ccs/components/govuk/accordion.rb +43 -41
  19. data/lib/ccs/components/govuk/back_link.rb +39 -37
  20. data/lib/ccs/components/govuk/breadcrumbs/link.rb +42 -40
  21. data/lib/ccs/components/govuk/breadcrumbs.rb +40 -38
  22. data/lib/ccs/components/govuk/button.rb +83 -81
  23. data/lib/ccs/components/govuk/cookie_banner/action.rb +45 -43
  24. data/lib/ccs/components/govuk/cookie_banner/message.rb +57 -55
  25. data/lib/ccs/components/govuk/cookie_banner.rb +40 -38
  26. data/lib/ccs/components/govuk/details.rb +38 -36
  27. data/lib/ccs/components/govuk/error_message.rb +46 -44
  28. data/lib/ccs/components/govuk/error_summary/item.rb +41 -39
  29. data/lib/ccs/components/govuk/error_summary.rb +49 -47
  30. data/lib/ccs/components/govuk/field/input/character_count.rb +101 -99
  31. data/lib/ccs/components/govuk/field/input/file_upload.rb +29 -27
  32. data/lib/ccs/components/govuk/field/input/select.rb +61 -59
  33. data/lib/ccs/components/govuk/field/input/text_input/fix.rb +39 -37
  34. data/lib/ccs/components/govuk/field/input/text_input.rb +75 -73
  35. data/lib/ccs/components/govuk/field/input/textarea.rb +43 -41
  36. data/lib/ccs/components/govuk/field/input.rb +46 -44
  37. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +43 -41
  38. data/lib/ccs/components/govuk/field/inputs/date_input/item.rb +48 -46
  39. data/lib/ccs/components/govuk/field/inputs/date_input.rb +68 -66
  40. data/lib/ccs/components/govuk/field/inputs/item/checkbox/form.rb +29 -27
  41. data/lib/ccs/components/govuk/field/inputs/item/checkbox/tag.rb +26 -24
  42. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +32 -30
  43. data/lib/ccs/components/govuk/field/inputs/item/divider.rb +39 -37
  44. data/lib/ccs/components/govuk/field/inputs/item/radio/form.rb +27 -25
  45. data/lib/ccs/components/govuk/field/inputs/item/radio/tag.rb +26 -24
  46. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +32 -30
  47. data/lib/ccs/components/govuk/field/inputs/item.rb +100 -98
  48. data/lib/ccs/components/govuk/field/inputs/radios.rb +43 -41
  49. data/lib/ccs/components/govuk/field/inputs.rb +42 -40
  50. data/lib/ccs/components/govuk/field.rb +90 -88
  51. data/lib/ccs/components/govuk/fieldset/legend.rb +50 -48
  52. data/lib/ccs/components/govuk/fieldset.rb +40 -38
  53. data/lib/ccs/components/govuk/footer/link.rb +41 -39
  54. data/lib/ccs/components/govuk/footer/meta.rb +49 -48
  55. data/lib/ccs/components/govuk/footer/navigation.rb +51 -50
  56. data/lib/ccs/components/govuk/footer.rb +105 -103
  57. data/lib/ccs/components/govuk/form_group.rb +45 -43
  58. data/lib/ccs/components/govuk/header/link.rb +41 -39
  59. data/lib/ccs/components/govuk/header/navigation.rb +54 -53
  60. data/lib/ccs/components/govuk/header.rb +84 -82
  61. data/lib/ccs/components/govuk/hint.rb +33 -31
  62. data/lib/ccs/components/govuk/inset_text.rb +39 -37
  63. data/lib/ccs/components/govuk/label.rb +61 -59
  64. data/lib/ccs/components/govuk/notification_banner.rb +83 -81
  65. data/lib/ccs/components/govuk/pagination/increment/next.rb +29 -27
  66. data/lib/ccs/components/govuk/pagination/increment/previous.rb +28 -26
  67. data/lib/ccs/components/govuk/pagination/increment.rb +78 -76
  68. data/lib/ccs/components/govuk/pagination/item/ellipsis.rb +17 -15
  69. data/lib/ccs/components/govuk/pagination/item/form.rb +34 -32
  70. data/lib/ccs/components/govuk/pagination/item/tag.rb +33 -31
  71. data/lib/ccs/components/govuk/pagination/item.rb +47 -45
  72. data/lib/ccs/components/govuk/pagination.rb +69 -67
  73. data/lib/ccs/components/govuk/panel.rb +49 -47
  74. data/lib/ccs/components/govuk/phase_banner.rb +50 -48
  75. data/lib/ccs/components/govuk/skip_link.rb +39 -37
  76. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list/item.rb +40 -38
  77. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/list.rb +30 -28
  78. data/lib/ccs/components/govuk/step_by_step_navigation/section/content/paragraph.rb +28 -26
  79. data/lib/ccs/components/govuk/step_by_step_navigation/section/content.rb +47 -45
  80. data/lib/ccs/components/govuk/step_by_step_navigation/section/heading.rb +49 -47
  81. data/lib/ccs/components/govuk/step_by_step_navigation/section.rb +44 -42
  82. data/lib/ccs/components/govuk/step_by_step_navigation.rb +41 -39
  83. data/lib/ccs/components/govuk/summary_list/action/link.rb +46 -44
  84. data/lib/ccs/components/govuk/summary_list/card/actions.rb +38 -36
  85. data/lib/ccs/components/govuk/summary_list/card/title.rb +37 -35
  86. data/lib/ccs/components/govuk/summary_list/card.rb +48 -46
  87. data/lib/ccs/components/govuk/summary_list/row/actions.rb +38 -36
  88. data/lib/ccs/components/govuk/summary_list/row/key.rb +30 -28
  89. data/lib/ccs/components/govuk/summary_list/row/value.rb +30 -28
  90. data/lib/ccs/components/govuk/summary_list/row.rb +47 -45
  91. data/lib/ccs/components/govuk/summary_list.rb +48 -46
  92. data/lib/ccs/components/govuk/table/body/data_cell.rb +38 -36
  93. data/lib/ccs/components/govuk/table/body/head_cell.rb +37 -35
  94. data/lib/ccs/components/govuk/table/header/head_cell.rb +39 -37
  95. data/lib/ccs/components/govuk/table.rb +83 -81
  96. data/lib/ccs/components/govuk/tabs/panel.rb +47 -45
  97. data/lib/ccs/components/govuk/tabs/tab.rb +42 -40
  98. data/lib/ccs/components/govuk/tabs.rb +48 -46
  99. data/lib/ccs/components/govuk/tag.rb +39 -37
  100. data/lib/ccs/components/govuk/warning_text.rb +49 -47
  101. data/lib/ccs/frontend_helpers/ccs_frontend/dashboard_section.rb +16 -14
  102. data/lib/ccs/frontend_helpers/ccs_frontend/footer.rb +17 -15
  103. data/lib/ccs/frontend_helpers/ccs_frontend/header.rb +17 -15
  104. data/lib/ccs/frontend_helpers/ccs_frontend.rb +1 -1
  105. data/lib/ccs/frontend_helpers/govuk_frontend/accordion.rb +17 -15
  106. data/lib/ccs/frontend_helpers/govuk_frontend/back_link.rb +17 -15
  107. data/lib/ccs/frontend_helpers/govuk_frontend/breadcrumbs.rb +17 -15
  108. data/lib/ccs/frontend_helpers/govuk_frontend/button.rb +17 -15
  109. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +17 -15
  110. data/lib/ccs/frontend_helpers/govuk_frontend/checkboxes.rb +17 -15
  111. data/lib/ccs/frontend_helpers/govuk_frontend/cookie_banner.rb +17 -15
  112. data/lib/ccs/frontend_helpers/govuk_frontend/date_input.rb +17 -15
  113. data/lib/ccs/frontend_helpers/govuk_frontend/details.rb +19 -17
  114. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +32 -30
  115. data/lib/ccs/frontend_helpers/govuk_frontend/error_summary.rb +38 -36
  116. data/lib/ccs/frontend_helpers/govuk_frontend/fieldset.rb +19 -17
  117. data/lib/ccs/frontend_helpers/govuk_frontend/file_upload.rb +17 -15
  118. data/lib/ccs/frontend_helpers/govuk_frontend/footer.rb +17 -15
  119. data/lib/ccs/frontend_helpers/govuk_frontend/form_group.rb +27 -25
  120. data/lib/ccs/frontend_helpers/govuk_frontend/header.rb +17 -15
  121. data/lib/ccs/frontend_helpers/govuk_frontend/hint.rb +18 -16
  122. data/lib/ccs/frontend_helpers/govuk_frontend/input.rb +17 -15
  123. data/lib/ccs/frontend_helpers/govuk_frontend/inset_text.rb +19 -17
  124. data/lib/ccs/frontend_helpers/govuk_frontend/label.rb +18 -16
  125. data/lib/ccs/frontend_helpers/govuk_frontend/notification_banner.rb +19 -17
  126. data/lib/ccs/frontend_helpers/govuk_frontend/pagination.rb +17 -15
  127. data/lib/ccs/frontend_helpers/govuk_frontend/panel.rb +19 -17
  128. data/lib/ccs/frontend_helpers/govuk_frontend/phase_banner.rb +19 -17
  129. data/lib/ccs/frontend_helpers/govuk_frontend/radios.rb +17 -15
  130. data/lib/ccs/frontend_helpers/govuk_frontend/select.rb +17 -15
  131. data/lib/ccs/frontend_helpers/govuk_frontend/skip_link.rb +17 -15
  132. data/lib/ccs/frontend_helpers/govuk_frontend/step_by_step_navigation.rb +24 -22
  133. data/lib/ccs/frontend_helpers/govuk_frontend/summary_list.rb +17 -15
  134. data/lib/ccs/frontend_helpers/govuk_frontend/table.rb +17 -15
  135. data/lib/ccs/frontend_helpers/govuk_frontend/tabs.rb +17 -15
  136. data/lib/ccs/frontend_helpers/govuk_frontend/tag.rb +17 -15
  137. data/lib/ccs/frontend_helpers/govuk_frontend/textarea.rb +17 -15
  138. data/lib/ccs/frontend_helpers/govuk_frontend/warning_text.rb +19 -17
  139. data/lib/ccs/frontend_helpers/version.rb +1 -1
  140. metadata +2 -2
@@ -1,67 +1,68 @@
1
- require_relative '../../base'
2
1
  require_relative 'link'
3
2
 
4
- module CCS::Components
5
- module GovUK
6
- class Header < Base
7
- # = GOV.UK Header navigation
8
- #
9
- # The header navigation section
10
- #
11
- # @!attribute [r] navigation_links
12
- # @return [Array<Link>] An array of the initialised navigation links
13
- # @!attribute [r] navigation_label
14
- # @return [String] The aria label for the navigation
15
- # @!attribute [r] navigation_classes
16
- # @return [String] The classes for the navigation
17
- # @!attribute [r] menu_button
18
- # @return [Hash] The options for the menu button
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ class Header < Base
7
+ # = GOV.UK Header navigation
8
+ #
9
+ # The header navigation section
10
+ #
11
+ # @!attribute [r] navigation_links
12
+ # @return [Array<Link>] An array of the initialised navigation links
13
+ # @!attribute [r] navigation_label
14
+ # @return [String] The aria label for the navigation
15
+ # @!attribute [r] navigation_classes
16
+ # @return [String] The classes for the navigation
17
+ # @!attribute [r] menu_button
18
+ # @return [Hash] The options for the menu button
19
19
 
20
- class Navigation
21
- include ActionView::Context
22
- include ActionView::Helpers
20
+ class Navigation
21
+ include ActionView::Context
22
+ include ActionView::Helpers
23
23
 
24
- private
24
+ private
25
25
 
26
- attr_reader :navigation_links, :navigation_label, :navigation_classes, :menu_button
26
+ attr_reader :navigation_links, :navigation_label, :navigation_classes, :menu_button
27
27
 
28
- public
28
+ public
29
29
 
30
- # @param navigation [Hash] options for the navigation
31
- # @param context [ActionView::Base] the view context
32
- # @param menu_button [Hash] options for the menu button
33
- #
34
- # @option navigation [Array] :items an array of links for the navigation section.
35
- # See {Components::GovUK::Header::Link#initialize Link#initialize} for details of the items in the array.
36
- # @option navigation [String] :classes additional CSS classes for the navigation HTML
37
- # @option navigation [String] :label text for the aria-label attribute of the navigation. Defaults to the menu button text
38
- #
39
- # @option menu_button [String] :text text for the button that opens the mobile navigation menu.
40
- # By default, this is set to +Menu+.
41
- # @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
42
- # Defaults to +Show or hide menu+.
30
+ # @param navigation [Hash] options for the navigation
31
+ # @param context [ActionView::Base] the view context
32
+ # @param menu_button [Hash] options for the menu button
33
+ #
34
+ # @option navigation [Array] :items an array of links for the navigation section.
35
+ # See {Components::GovUK::Header::Link#initialize Link#initialize} for details of the items in the array.
36
+ # @option navigation [String] :classes additional CSS classes for the navigation HTML
37
+ # @option navigation [String] :label text for the aria-label attribute of the navigation. Defaults to the menu button text
38
+ #
39
+ # @option menu_button [String] :text text for the button that opens the mobile navigation menu.
40
+ # By default, this is set to +Menu+.
41
+ # @option menu_button [String] :label text for the aria-label attribute of the button that opens the mobile navigation.
42
+ # Defaults to +Show or hide menu+.
43
43
 
44
- def initialize(navigation:, context:, menu_button: nil)
45
- menu_button ||= {}
46
- menu_button[:text] ||= 'Menu'
47
- menu_button[:label] ||= 'Show or hide menu'
44
+ def initialize(navigation:, context:, menu_button: nil)
45
+ menu_button ||= {}
46
+ menu_button[:text] ||= 'Menu'
47
+ menu_button[:label] ||= 'Show or hide menu'
48
48
 
49
- @menu_button = menu_button
50
- @navigation_links = navigation[:items].map { |navigation_link| Link.new(context: context, **navigation_link) }
51
- @navigation_label = navigation[:label] || menu_button[:text]
52
- @navigation_classes = "govuk-header__navigation #{navigation[:classes]}".rstrip
53
- end
49
+ @menu_button = menu_button
50
+ @navigation_links = navigation[:items].map { |navigation_link| Link.new(context: context, **navigation_link) }
51
+ @navigation_label = navigation[:label] || menu_button[:text]
52
+ @navigation_classes = "govuk-header__navigation #{navigation[:classes]}".rstrip
53
+ end
54
54
 
55
- # Generates the HTML for the GOV.UK Navigation
56
- #
57
- # @return [ActiveSupport::SafeBuffer]
55
+ # Generates the HTML for the GOV.UK Navigation
56
+ #
57
+ # @return [ActiveSupport::SafeBuffer]
58
58
 
59
- def render
60
- tag.nav(aria: { label: navigation_label }, class: navigation_classes) do
61
- concat(button_tag(menu_button[:text], type: :button, class: 'govuk-header__menu-button govuk-js-header-toggle', aria: { controls: 'navigation', label: menu_button[:label] }, hidden: true))
62
- concat(tag.ul(id: 'navigation', class: 'govuk-header__navigation-list') do
63
- navigation_links.each { |navigation_link| concat(navigation_link.render) }
64
- end)
59
+ def render
60
+ tag.nav(aria: { label: navigation_label }, class: navigation_classes) do
61
+ concat(button_tag(menu_button[:text], type: :button, class: 'govuk-header__menu-button govuk-js-header-toggle', aria: { controls: 'navigation', label: menu_button[:label] }, hidden: true))
62
+ concat(tag.ul(id: 'navigation', class: 'govuk-header__navigation-list') do
63
+ navigation_links.each { |navigation_link| concat(navigation_link.render) }
64
+ end)
65
+ end
65
66
  end
66
67
  end
67
68
  end
@@ -1,103 +1,105 @@
1
1
  require_relative '../base'
2
2
  require_relative 'header/navigation'
3
3
 
4
- module CCS::Components
5
- module GovUK
6
- # = GOV.UK Header
7
- #
8
- # This is used to generate the header component from the
9
- # {https://design-system.service.gov.uk/components/header GDS - Components - Header}
10
- #
11
- # @!attribute [r] navigation
12
- # @return [Navigation] The initialised navigation section
13
- # @!attribute [r] service
14
- # @return [Hash] The options for the service section
15
-
16
- class Header < Base
17
- private
18
-
19
- attr_reader :navigation, :service
20
-
21
- public
22
-
23
- # @param navigation [Hash] options for the navigation section of the header.
24
- # See {Components::GovUK::Header::Navigation#initialize Navigation#initialize} for details of the options.
25
- # @param menu_button [Hash] options for the menu button in the header.
26
- # See {Components::GovUK::Header::Navigation#initialize Navigation#initialize} for details of the options.
27
- # @param service [Hash] options for the service name
28
- # @param options [Hash] options that will be used in customising the HTML
4
+ module CCS
5
+ module Components
6
+ module GovUK
7
+ # = GOV.UK Header
29
8
  #
30
- # @option service [String] :name the name of the service, included in the header
31
- # @option service [String] :href URL for the service name anchor
9
+ # This is used to generate the header component from the
10
+ # {https://design-system.service.gov.uk/components/header GDS - Components - Header}
32
11
  #
33
- # @option options [String] :classes additional CSS classes for the header HTML
34
- # @option options [String] :container_classes classes for the container
35
- # @option options [String] :homepage_url URL of the homepage. Defaults to +/+
36
- # @option options [String] :product_name product name, used when the product name follows on directly from ‘GOV.UK
37
- # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
38
-
39
- def initialize(navigation: nil, menu_button: nil, service: nil, **options)
40
- super(**options)
41
-
42
- @options[:attributes][:role] = 'banner'
43
- @options[:container_classes] ||= 'govuk-width-container'
44
- @options[:homepage_url] ||= '/'
45
-
46
- @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation
47
- @service = service
48
- end
12
+ # @!attribute [r] navigation
13
+ # @return [Navigation] The initialised navigation section
14
+ # @!attribute [r] service
15
+ # @return [Hash] The options for the service section
16
+
17
+ class Header < Base
18
+ private
19
+
20
+ attr_reader :navigation, :service
21
+
22
+ public
23
+
24
+ # @param navigation [Hash] options for the navigation section of the header.
25
+ # See {Components::GovUK::Header::Navigation#initialize Navigation#initialize} for details of the options.
26
+ # @param menu_button [Hash] options for the menu button in the header.
27
+ # See {Components::GovUK::Header::Navigation#initialize Navigation#initialize} for details of the options.
28
+ # @param service [Hash] options for the service name
29
+ # @param options [Hash] options that will be used in customising the HTML
30
+ #
31
+ # @option service [String] :name the name of the service, included in the header
32
+ # @option service [String] :href URL for the service name anchor
33
+ #
34
+ # @option options [String] :classes additional CSS classes for the header HTML
35
+ # @option options [String] :container_classes classes for the container
36
+ # @option options [String] :homepage_url URL of the homepage. Defaults to +/+
37
+ # @option options [String] :product_name product name, used when the product name follows on directly from ‘GOV.UK
38
+ # @option options [Hash] :attributes additional attributes that will added as part of the header HTML
39
+
40
+ def initialize(navigation: nil, menu_button: nil, service: nil, **options)
41
+ super(**options)
42
+
43
+ @options[:attributes][:role] = 'banner'
44
+ @options[:container_classes] ||= 'govuk-width-container'
45
+ @options[:homepage_url] ||= '/'
46
+
47
+ @navigation = Navigation.new(navigation: navigation, menu_button: menu_button, context: @context) if navigation
48
+ @service = service
49
+ end
49
50
 
50
- # Generates the HTML for the GOV.UK Header component
51
- #
52
- # @return [ActiveSupport::SafeBuffer]
53
-
54
- def render
55
- tag.header(**options[:attributes]) do
56
- tag.div(class: "govuk-header__container #{options[:container_classes]}") do
57
- concat(header_logo)
58
- if service || navigation
59
- concat(tag.div(class: 'govuk-header__content') do
60
- concat(header_service_name) if service
61
- concat(navigation.render) if navigation
62
- end)
51
+ # Generates the HTML for the GOV.UK Header component
52
+ #
53
+ # @return [ActiveSupport::SafeBuffer]
54
+
55
+ def render
56
+ tag.header(**options[:attributes]) do
57
+ tag.div(class: "govuk-header__container #{options[:container_classes]}") do
58
+ concat(header_logo)
59
+ if service || navigation
60
+ concat(tag.div(class: 'govuk-header__content') do
61
+ concat(header_service_name) if service
62
+ concat(navigation.render) if navigation
63
+ end)
64
+ end
63
65
  end
64
66
  end
65
67
  end
66
- end
67
68
 
68
- # The default attributes for the breadcrumbs
69
+ # The default attributes for the breadcrumbs
69
70
 
70
- DEFAULT_ATTRIBUTES = { class: 'govuk-header', data: { module: 'govuk-header' } }.freeze
71
+ DEFAULT_ATTRIBUTES = { class: 'govuk-header', data: { module: 'govuk-header' } }.freeze
71
72
 
72
- private
73
+ private
73
74
 
74
- # Generates the logo for header
75
- #
76
- # @return [ActiveSupport::SafeBuffer]
77
-
78
- def header_logo
79
- tag.div(class: 'govuk-header__logo') do
80
- link_to(options[:homepage_url], class: 'govuk-header__link govuk-header__link--homepage') do
81
- concat(tag.span(class: 'govuk-header__logotype') do
82
- concat(tag.svg(class: 'govuk-header__logotype-crown', xmlns: 'http://www.w3.org/2000/svg', height: '30', width: '36', aria: { hidden: 'true' }, focusable: 'false', viewBox: '0 0 132 97') do
83
- tag.path(fill: 'currentColor', 'fill-rule': 'evenodd', d: 'M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-1.5-7.6.3-9.1 3.8-1.4 3.5.3 7.6 3.9 9.1zm38.3-21.4c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.6-1.5-7.6.3-9.1 3.8-1.3 3.6.4 7.7 3.9 9.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1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z')
75
+ # Generates the logo for header
76
+ #
77
+ # @return [ActiveSupport::SafeBuffer]
78
+
79
+ def header_logo
80
+ tag.div(class: 'govuk-header__logo') do
81
+ link_to(options[:homepage_url], class: 'govuk-header__link govuk-header__link--homepage') do
82
+ concat(tag.span(class: 'govuk-header__logotype') do
83
+ concat(tag.svg(class: 'govuk-header__logotype-crown', xmlns: 'http://www.w3.org/2000/svg', height: '30', width: '36', aria: { hidden: 'true' }, focusable: 'false', viewBox: '0 0 132 97') do
84
+ tag.path(fill: 'currentColor', 'fill-rule': 'evenodd', d: 'M25 30.2c3.5 1.5 7.7-.2 9.1-3.7 1.5-3.6-.2-7.8-3.9-9.2-3.6-1.4-7.6.3-9.1 3.9-1.4 3.5.3 7.5 3.9 9zM9 39.5c3.6 1.5 7.8-.2 9.2-3.7 1.5-3.6-.2-7.8-3.9-9.1-3.6-1.5-7.6.2-9.1 3.8-1.4 3.5.3 7.5 3.8 9zM4.4 57.2c3.5 1.5 7.7-.2 9.1-3.8 1.5-3.6-.2-7.7-3.9-9.1-3.5-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7.9-13.5 2.1-21.1-8 6.1-8.1 12.3-4.5 20.8-4.7-5.4-12.1-2.5-9.5 6.2 3.4-5.2 7.9-2 7.2 3.1-.6 4.3-6.4 7.8-13.5 7.2-10.3-.9-10.9-8-11.2-13.8 2.5-.5 7.1 1.8 11 7.3L80.2 60c-4.1 4.4-8 5.3-12.3 5.4 1.4-4.4 8-11.6 8-11.6H55.5s6.4 7.2 7.9 11.6c-4.2-.1-8-1-12.3-5.4l1.4 16.4c3.9-5.5 8.5-7.7 10.9-7.3-.3 5.8-.9 12.8-11.1 13.8-7.2.6-12.9-2.9-13.5-7.2-.7-5 3.8-8.3 7.1-3.1 2.7-8.7-4.6-11.6-9.4-6.2 3.7-8.5 3.6-14.7-4.6-20.8-5.8 7.6-5 13.9 2.2 21.1-4.7-2.6-11.9.1-7.7 8.8 2.3-5.5 7.1-4.2 8.1.5.7 3.3-1.3 7.1-5.7 7.9-3.5.7-9-1.8-13.5-11.2 2.5.1 4.7 1.3 7.5 3.3l-4.7-15.4c-1.2 4.4-2.7 7.2-4.3 8.7-1.1-3-.9-5.3 0-10.2l-9.5 3.4c5 6.9 9.9 16.7 14 33.5 14.8-2.1 30.8-3.2 47.7-3.2z')
85
+ end)
86
+ concat(tag.span('GOV.UK', class: 'govuk-header__logotype-text'))
84
87
  end)
85
- concat(tag.span('GOV.UK', class: 'govuk-header__logotype-text'))
86
- end)
87
- concat(tag.span(options[:product_name], class: 'govuk-header__product-name')) if options[:product_name]
88
+ concat(tag.span(options[:product_name], class: 'govuk-header__product-name')) if options[:product_name]
89
+ end
88
90
  end
89
91
  end
90
- end
91
92
 
92
- # Generates the service name section
93
- #
94
- # @return [ActiveSupport::SafeBuffer]
93
+ # Generates the service name section
94
+ #
95
+ # @return [ActiveSupport::SafeBuffer]
95
96
 
96
- def header_service_name
97
- if service[:href]
98
- link_to(service[:name], service[:href], class: 'govuk-header__link govuk-header__service-name')
99
- else
100
- tag.span(service[:name], class: 'govuk-header__service-name')
97
+ def header_service_name
98
+ if service[:href]
99
+ link_to(service[:name], service[:href], class: 'govuk-header__link govuk-header__service-name')
100
+ else
101
+ tag.span(service[:name], class: 'govuk-header__service-name')
102
+ end
101
103
  end
102
104
  end
103
105
  end
@@ -1,47 +1,49 @@
1
1
  require_relative '../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- # = GOV.UK Hint
6
- #
7
- # This is used to generate the hint text component from the Government Design Systems
8
- #
9
- # @!attribute [r] text
10
- # @return [String] Text for the hint
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ # = GOV.UK Hint
7
+ #
8
+ # This is used to generate the hint text component from the Government Design Systems
9
+ #
10
+ # @!attribute [r] text
11
+ # @return [String] Text for the hint
11
12
 
12
- class Hint < Base
13
- private
13
+ class Hint < Base
14
+ private
14
15
 
15
- attr_reader :text
16
+ attr_reader :text
16
17
 
17
- public
18
+ public
18
19
 
19
- # @param text [String] the hint text.
20
- # If nil, then a block will be rendered
21
- # @param options [Hash] options that will be used in customising the HTML
22
- #
23
- # @option options [String] :classes additional CSS classes for the hint HTML
24
- # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
20
+ # @param text [String] the hint text.
21
+ # If nil, then a block will be rendered
22
+ # @param options [Hash] options that will be used in customising the HTML
23
+ #
24
+ # @option options [String] :classes additional CSS classes for the hint HTML
25
+ # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
25
26
 
26
- def initialize(text: nil, **options)
27
- super(**options)
27
+ def initialize(text: nil, **options)
28
+ super(**options)
28
29
 
29
- @text = text
30
- end
30
+ @text = text
31
+ end
31
32
 
32
- # Generates the HTML for the GOV.UK Hint component
33
- #
34
- # @return [ActiveSupport::SafeBuffer]
33
+ # Generates the HTML for the GOV.UK Hint component
34
+ #
35
+ # @return [ActiveSupport::SafeBuffer]
35
36
 
36
- def render
37
- tag.div(**options[:attributes]) do
38
- text || yield
37
+ def render
38
+ tag.div(**options[:attributes]) do
39
+ text || yield
40
+ end
39
41
  end
40
- end
41
42
 
42
- # The default attributes for the hint
43
+ # The default attributes for the hint
43
44
 
44
- DEFAULT_ATTRIBUTES = { class: 'govuk-hint' }.freeze
45
+ DEFAULT_ATTRIBUTES = { class: 'govuk-hint' }.freeze
46
+ end
45
47
  end
46
48
  end
47
49
  end
@@ -1,50 +1,52 @@
1
1
  require_relative '../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- # = GOV.UK Inset Text
6
- #
7
- # This is used to generate the inset text component from the
8
- # {https://design-system.service.gov.uk/components/inset-text GDS - Components - Inset text}
9
- #
10
- # @!attribute [r] text
11
- # @return [String] Text for the inset text
12
-
13
- class InsetText < Base
14
- private
15
-
16
- attr_reader :text
17
-
18
- public
19
-
20
- # @param text [String] text to use within the inset text component.
21
- # If nil, then a block will be rendered
22
- # @param options [Hash] options that will be used in customising the HTML
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ # = GOV.UK Inset Text
23
7
  #
24
- # @option options [String] :classes additional CSS classes for the inset text HTML
25
- # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
8
+ # This is used to generate the inset text component from the
9
+ # {https://design-system.service.gov.uk/components/inset-text GDS - Components - Inset text}
10
+ #
11
+ # @!attribute [r] text
12
+ # @return [String] Text for the inset text
26
13
 
27
- def initialize(text: nil, **options)
28
- super(**options)
14
+ class InsetText < Base
15
+ private
29
16
 
30
- @text = text
31
- end
17
+ attr_reader :text
32
18
 
33
- # Generates the HTML for the GOV.UK Inset text component
34
- #
35
- # @yield HTML that will be contained within the inset text div. Ignored if inset text is given
36
- #
37
- # @return [ActiveSupport::SafeBuffer]
19
+ public
20
+
21
+ # @param text [String] text to use within the inset text component.
22
+ # If nil, then a block will be rendered
23
+ # @param options [Hash] options that will be used in customising the HTML
24
+ #
25
+ # @option options [String] :classes additional CSS classes for the inset text HTML
26
+ # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
27
+
28
+ def initialize(text: nil, **options)
29
+ super(**options)
38
30
 
39
- def render
40
- tag.div(**options[:attributes]) do
41
- text || yield
31
+ @text = text
42
32
  end
43
- end
44
33
 
45
- # The default attributes for the inset text
34
+ # Generates the HTML for the GOV.UK Inset text component
35
+ #
36
+ # @yield HTML that will be contained within the inset text div. Ignored if inset text is given
37
+ #
38
+ # @return [ActiveSupport::SafeBuffer]
39
+
40
+ def render
41
+ tag.div(**options[:attributes]) do
42
+ text || yield
43
+ end
44
+ end
46
45
 
47
- DEFAULT_ATTRIBUTES = { class: 'govuk-inset-text' }.freeze
46
+ # The default attributes for the inset text
47
+
48
+ DEFAULT_ATTRIBUTES = { class: 'govuk-inset-text' }.freeze
49
+ end
48
50
  end
49
51
  end
50
52
  end
@@ -1,80 +1,82 @@
1
1
  require_relative '../base'
2
2
 
3
- module CCS::Components
4
- module GovUK
5
- # = GOV.UK Label
6
- #
7
- # This is used to generate the label component from the Government Design Systems
8
- #
9
- # @!attribute [r] attribute
10
- # @return [String, Symbol] Attribute of the input that requires a label
11
- # @!attribute [r] text
12
- # @return [String] Text for the label
13
- # @!attribute [r] form
14
- # @return [ActionView::Helpers::FormBuilder] Form builder used to create the label
3
+ module CCS
4
+ module Components
5
+ module GovUK
6
+ # = GOV.UK Label
7
+ #
8
+ # This is used to generate the label component from the Government Design Systems
9
+ #
10
+ # @!attribute [r] attribute
11
+ # @return [String, Symbol] Attribute of the input that requires a label
12
+ # @!attribute [r] text
13
+ # @return [String] Text for the label
14
+ # @!attribute [r] form
15
+ # @return [ActionView::Helpers::FormBuilder] Form builder used to create the label
15
16
 
16
- class Label < Base
17
- private
17
+ class Label < Base
18
+ private
18
19
 
19
- attr_reader :attribute, :text, :form
20
+ attr_reader :attribute, :text, :form
20
21
 
21
- public
22
+ public
22
23
 
23
- # @param attribute [String, Symbol] the attribute of the input that requires a label
24
- # @param text [String] (nil) the text for the label
25
- # If nil, then a block will be rendered
26
- # @param form [ActionView::Helpers::FormBuilder] (nil) optional form builder used to create the label
27
- # @param options [Hash] options that will be used in customising the HTML
28
- #
29
- # @option options [String] :classes additional CSS classes for the label HTML
30
- # @option options [Boolean] :is_page_heading (false) if the label is also the heading it will rendered in a h1
31
- # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
24
+ # @param attribute [String, Symbol] the attribute of the input that requires a label
25
+ # @param text [String] (nil) the text for the label
26
+ # If nil, then a block will be rendered
27
+ # @param form [ActionView::Helpers::FormBuilder] (nil) optional form builder used to create the label
28
+ # @param options [Hash] options that will be used in customising the HTML
29
+ #
30
+ # @option options [String] :classes additional CSS classes for the label HTML
31
+ # @option options [Boolean] :is_page_heading (false) if the label is also the heading it will rendered in a h1
32
+ # @option options [Hash] :attributes ({}) any additional attributes that will added as part of the HTML
32
33
 
33
- def initialize(attribute:, text: nil, form: nil, **options)
34
- super(**options)
34
+ def initialize(attribute:, text: nil, form: nil, **options)
35
+ super(**options)
35
36
 
36
- @attribute = attribute
37
- @text = text
38
- @form = form
39
- end
37
+ @attribute = attribute
38
+ @text = text
39
+ @form = form
40
+ end
40
41
 
41
- # Generates the HTML for the GOV.UK label component
42
- #
43
- # @yield HTML that will be generated for the label
44
- #
45
- # @return [ActiveSupport::SafeBuffer]
42
+ # Generates the HTML for the GOV.UK label component
43
+ #
44
+ # @yield HTML that will be generated for the label
45
+ #
46
+ # @return [ActiveSupport::SafeBuffer]
46
47
 
47
- def render(&block)
48
- if options[:is_page_heading]
49
- tag.h1(class: 'govuk-label-wrapper') do
48
+ def render(&block)
49
+ if options[:is_page_heading]
50
+ tag.h1(class: 'govuk-label-wrapper') do
51
+ label_html(&block)
52
+ end
53
+ else
50
54
  label_html(&block)
51
55
  end
52
- else
53
- label_html(&block)
54
56
  end
55
- end
56
57
 
57
- # The default attributes for the label
58
+ # The default attributes for the label
58
59
 
59
- DEFAULT_ATTRIBUTES = { class: 'govuk-label' }.freeze
60
+ DEFAULT_ATTRIBUTES = { class: 'govuk-label' }.freeze
60
61
 
61
- private
62
+ private
62
63
 
63
- # Generates the HTML for the label.
64
- # If +:form+ attribute is present, it will be used to generate the label tag
65
- #
66
- # @yield HTML that will be used in the label. Ignored if text is passed.
67
- #
68
- # @return [ActiveSupport::SafeBuffer]
64
+ # Generates the HTML for the label.
65
+ # If +:form+ attribute is present, it will be used to generate the label tag
66
+ #
67
+ # @yield HTML that will be used in the label. Ignored if text is passed.
68
+ #
69
+ # @return [ActiveSupport::SafeBuffer]
69
70
 
70
- def label_html
71
- if form
72
- form.label(attribute, **options[:attributes]) do
73
- text || yield
74
- end
75
- else
76
- label_tag(attribute, **options[:attributes]) do
77
- text || yield
71
+ def label_html
72
+ if form
73
+ form.label(attribute, **options[:attributes]) do
74
+ text || yield
75
+ end
76
+ else
77
+ label_tag(attribute, **options[:attributes]) do
78
+ text || yield
79
+ end
78
80
  end
79
81
  end
80
82
  end