Skip to content

Commit d331e05

Browse files
authored
Merge pull request #244 from Crown-Commercial-Service/update-ccs-frontend-to-v2
Updated CCS Frontend to v2.0.0
2 parents 9c87e89 + ab81eb6 commit d331e05

File tree

18 files changed

+109
-1238
lines changed

18 files changed

+109
-1238
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Updated CCS Frontend to v2.0.0
13+
14+
### Removed
15+
16+
- The CCS Header is now just the logo as all other parts should now go in the GOV.UK Service Navigation component
17+
1018
## [2.5.0] - 2025-06-30
1119

1220
### Added

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
ccs-frontend_helpers (2.5.0)
4+
ccs-frontend_helpers (5.5.0)
55
rails (>= 7.2)
66

77
GEM

bun.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ccs/components/ccs/header.rb

Lines changed: 3 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
require_relative '../base'
22
require_relative 'logo'
3-
require_relative 'header/service_authentication'
4-
require_relative 'header/navigation'
53

64
module CCS
75
module Components
@@ -13,72 +11,42 @@ module CCS
1311
#
1412
# @!attribute [r] logo
1513
# @return [Logo] The initialised Logo component
16-
# @!attribute [r] service_authentication
17-
# @return [ServiceAuthentication] The initialised service authentication section
18-
# @!attribute [r] navigation
19-
# @return [Navigation] The initialised navigation section
20-
# @!attribute [r] service
21-
# @return [Hash] The options for the service section
2214

2315
class Header < Base
2416
private
2517

26-
attr_reader :logo, :service_authentication, :navigation, :service
18+
attr_reader :logo
2719

2820
public
2921

30-
# @param service_authentication_items [Array<Hash>] An array of links for the service authentication section of the header.
31-
# See {Components::CCS::Header::ServiceAuthentication#initialize ServiceAuthentication#initialize} for details of the items in the array.
32-
# @param navigation [Hash] options for the navigation section of the header.
33-
# See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
34-
# @param menu_button [Hash] options for the menu button in the header.
35-
# See {Components::CCS::Header::Navigation#initialize Navigation#initialize} for details of the options.
36-
# @param service [Hash] options for the service name
3722
# @param options [Hash] options that will be used in customising the HTML
3823
#
39-
# @option service [String] :name the name of the service, included in the header
40-
# @option service [String] :href URL for the service name anchor
41-
#
4224
# @option options [String] :classes additional CSS classes for the header HTML
4325
# @option options [String] :container_classes classes for the container
4426
# @option options [String] :homepage_url URL of the homepage. Defaults to +/https://www.crowncommercial.gov.uk+
4527
# @option options [Hash] :attributes additional attributes that will added as part of the header HTML
4628

47-
def initialize(service_authentication_items: nil, navigation: nil, menu_button: nil, service: nil, **)
48-
super(**)
29+
def initialize(**)
30+
super
4931

5032
@options[:container_classes] ||= 'govuk-width-container'
5133
@options[:homepage_url] ||= 'https://www.crowncommercial.gov.uk'
5234

5335
@logo = Logo.new(context: @context)
54-
@service_authentication = ServiceAuthentication.new(service_authentication_items: service_authentication_items, container_classes: @options[:container_classes], context: @context) if service_authentication_items
55-
@navigation = Navigation.new(navigation: navigation, serivce_name_present: service, menu_button: menu_button, context: @context) if navigation && (navigation[:primary_items] || navigation[:secondary_items])
56-
@service = service
5736
end
5837

59-
# rubocop:disable Metrics/AbcSize
60-
6138
# Generates the HTML for the CCS Header component
6239
#
6340
# @return [ActiveSupport::SafeBuffer]
6441

6542
def render
6643
tag.header(**options[:attributes]) do
67-
concat(service_authentication.render) if service_authentication
6844
concat(tag.div(class: "ccs-header__container #{options[:container_classes]}".rstrip) do
6945
concat(header_logo)
70-
if service || navigation
71-
concat(tag.div(class: 'ccs-header__content') do
72-
concat(header_service_name) if service
73-
concat(navigation.render) if navigation
74-
end)
75-
end
7646
end)
7747
end
7848
end
7949

80-
# rubocop:enable Metrics/AbcSize
81-
8250
# The default attributes for the breadcrumbs
8351

8452
DEFAULT_ATTRIBUTES = { class: 'ccs-header', data: { module: 'ccs-header' } }.freeze
@@ -94,18 +62,6 @@ def header_logo
9462
link_to(logo.render, options[:homepage_url], class: 'ccs-header__link ccs-header__link--homepage', aria: { label: 'Crown Commercial Service' })
9563
end
9664
end
97-
98-
# Generates the service name section
99-
#
100-
# @return [ActiveSupport::SafeBuffer]
101-
102-
def header_service_name
103-
if service[:href]
104-
link_to(service[:name], service[:href], class: 'ccs-header__link ccs-header__link--service-name')
105-
else
106-
tag.span(service[:name], class: 'ccs-header__link--service-name')
107-
end
108-
end
10965
end
11066
end
11167
end

lib/ccs/components/ccs/header/link.rb

Lines changed: 0 additions & 78 deletions
This file was deleted.

lib/ccs/components/ccs/header/navigation.rb

Lines changed: 0 additions & 99 deletions
This file was deleted.

lib/ccs/components/ccs/header/service_authentication.rb

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)