@@ -7,9 +7,30 @@ module CCS
77 #
88 # This is used for generating the logo component from the
99 # {https://github.com/Crown-Commercial-Service/ccs-frontend-project/tree/main/packages/ccs-frontend/src/ccs/components/logo CCS - Components - Logo}
10+ #
11+ # @!attribute [r] show_only_crown
12+ # @return [Boolean] Flag to show only the crown part of the logo
13+ # @!attribute [r] use_gca_branding
14+ # @return [Boolean] Flag to use GCA branding in logo
1015
1116 class Logo < Base
12- # rubocop:disable Metrics/AbcSize
17+ private
18+
19+ attr_reader :show_only_crown , :use_gca_branding
20+
21+ public
22+
23+ # @param show_only_crown [Boolean] flag to show only the crown part of the logo
24+ # @param use_gca_branding [Boolean] flag to use GCA branding in logo
25+
26+ def initialize ( show_only_crown : nil , use_gca_branding : nil , **)
27+ super
28+
29+ @show_only_crown = show_only_crown
30+ @use_gca_branding = use_gca_branding
31+ end
32+
33+ # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
1334
1435 # Generates the HTML for the CCS Logo.
1536 # Used in {CCS::Components::CCS::Header Header} and {CCS::Components::CCS::Footer Footer}
@@ -18,7 +39,7 @@ class Logo < Base
1839
1940 def render
2041 tag . span ( class : 'ccs-logo' ) do
21- if @options [ : show_only_crown]
42+ if show_only_crown
2243 concat ( tag . svg ( class : 'ccs-logo__svg' , xmlns : 'http://www.w3.org/2000/svg' , width : '132.22' , height : '121' , aria : { hidden : 'true' } , focusable : 'false' , viewBox : '0 0 371.06668 339.57333' ) do
2344 concat ( tag . g ( transform : 'matrix(1.3333333,0,0,-1.3333333,0,339.57333)' ) do
2445 tag . g ( transform : 'scale(0.34)' ) do
@@ -31,24 +52,36 @@ def render
3152 concat ( tag . g ( transform : 'matrix(1.3333333,0,0,-1.3333333,0,339.57333)' ) do
3253 tag . g ( transform : 'scale(0.1)' ) do
3354 CCS_STACKED_LOGO_PATHS . each { |ccs_logo_path_attributes | concat ( tag . path ( **ccs_logo_path_attributes ) ) }
34- concat ( logo_stacked_text_graphic )
55+ concat ( use_gca_branding ? logo_stacked_text_graphic_gca : logo_stacked_text_graphic_ccs )
3556 end
3657 end )
3758 end )
38- concat ( tag . svg ( class : 'ccs-logo__svg ccs-logo__svg--linear' , xmlns : 'http://www.w3.org/2000/svg' , width : '320' , height : '48.5' , aria : { hidden : 'true' } , focusable : 'false' , viewBox : '0 0 899 137' ) do
39- concat ( tag . g ( transform : 'matrix(1.3333333,0,0,-1.3333333,0,137)' ) do
40- tag . g ( transform : 'scale(0.1)' ) do
41- CCS_LINEAR_LOGO_PATHS . each { |ccs_logo_path_attributes | concat ( tag . path ( **ccs_logo_path_attributes ) ) }
42- concat ( logo_linear_text_graphic )
43- end
59+ if use_gca_branding
60+ concat ( tag . svg ( class : 'ccs-logo__svg ccs-logo__svg--linear' , xmlns : 'http://www.w3.org/2000/svg' , width : '378' , height : '48.5' , aria : { hidden : 'true' } , focusable : 'false' , viewBox : '0 0 1061 137' ) do
61+ concat ( tag . g ( transform : 'matrix(1.3333333,0,0,-1.3333333,0,137)' ) do
62+ tag . g ( transform : 'scale(0.1)' ) do
63+ CCS_LINEAR_LOGO_PATHS . each { |ccs_logo_path_attributes | concat ( tag . path ( **ccs_logo_path_attributes ) ) }
64+ concat ( logo_linear_text_graphic_gca )
65+ end
66+ end )
4467 end )
45- end )
46- concat ( tag . span ( 'Crown Commercial Service' , class : 'ccs-logo__text' , hidden : true ) )
68+ concat ( tag . span ( 'Government Commercial Agency' , class : 'ccs-logo__text' , hidden : true ) )
69+ else
70+ concat ( tag . svg ( class : 'ccs-logo__svg ccs-logo__svg--linear' , xmlns : 'http://www.w3.org/2000/svg' , width : '320' , height : '48.5' , aria : { hidden : 'true' } , focusable : 'false' , viewBox : '0 0 899 137' ) do
71+ concat ( tag . g ( transform : 'matrix(1.3333333,0,0,-1.3333333,0,137)' ) do
72+ tag . g ( transform : 'scale(0.1)' ) do
73+ CCS_LINEAR_LOGO_PATHS . each { |ccs_logo_path_attributes | concat ( tag . path ( **ccs_logo_path_attributes ) ) }
74+ concat ( logo_linear_text_graphic_ccs )
75+ end
76+ end )
77+ end )
78+ concat ( tag . span ( 'Crown Commercial Service' , class : 'ccs-logo__text' , hidden : true ) )
79+ end
4780 end
4881 end
4982 end
5083
51- # rubocop:enable Metrics/AbcSize
84+ # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
5285
5386 # Array of the SVG paths for the CCS Logo
5487
@@ -526,7 +559,7 @@ def render
526559
527560 private
528561
529- def logo_stacked_text_graphic
562+ def logo_stacked_text_graphic_ccs
530563 tag . g ( transform : 'scale(10)' ) do
531564 tag . text (
532565 'xml:space' : 'preserve' ,
@@ -540,7 +573,21 @@ def logo_stacked_text_graphic
540573 end
541574 end
542575
543- def logo_linear_text_graphic
576+ def logo_stacked_text_graphic_gca
577+ tag . g ( transform : 'scale(10)' ) do
578+ tag . text (
579+ 'xml:space' : 'preserve' ,
580+ transform : 'matrix(1,0,0,-1,20.3102,129.569)' ,
581+ class : 'ccs-logo__text-graphic'
582+ ) do
583+ concat ( tag . tspan ( 'Government ' , x : '0 35 62 85 110 125 149 188 212 237 250' , y : '0' , 'sodipodi:role' : 'line' ) )
584+ concat ( tag . tspan ( 'Commercial ' , x : '0 33.314499 59.416096 99.105995 138.7959 163.4126 177.5981 201.77882 210.5835 234.9653 244.37253' , y : '53' , 'sodipodi:role' : 'line' ) )
585+ concat ( tag . tspan ( 'Agency ' , x : '0 31.5 58 82.5 108 133.5' , y : '106' , 'sodipodi:role' : 'line' ) )
586+ end
587+ end
588+ end
589+
590+ def logo_linear_text_graphic_ccs
544591 tag . g ( transform : 'scale(10)' ) do
545592 tag . text (
546593 'xml:space' : 'preserve' ,
@@ -551,6 +598,18 @@ def logo_linear_text_graphic
551598 end
552599 end
553600 end
601+
602+ def logo_linear_text_graphic_gca
603+ tag . g ( transform : 'scale(10)' ) do
604+ tag . text (
605+ 'xml:space' : 'preserve' ,
606+ transform : 'matrix(1,0,0,-1,120,30)' ,
607+ class : 'ccs-logo__text-graphic'
608+ ) do
609+ concat ( tag . tspan ( 'Government Commercial Agency' , x : '0 35 62 85 110 125 149 188 212 237 250 260 293.314499 319.416096 359.105995 398.7959 423.4126 437.5981 461.77882 470.5835 494.9653 504.37253 515 546.5 573 597.5 623 648.5' , y : '0' , 'sodipodi:role' : 'line' ) )
610+ end
611+ end
612+ end
554613 end
555614 end
556615 end
0 commit comments