Skip to content

Commit dc0450d

Browse files
committed
Added boolean for i belong flag and corner flourish on full width banner component
Updated html and css for mobile and adding image flags Moved some svgs
1 parent e5025e9 commit dc0450d

File tree

8 files changed

+102
-23
lines changed

8 files changed

+102
-23
lines changed

app/components/cms/full_width_banner_component.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
class Cms::FullWidthBannerComponent < ViewComponent::Base
44
delegate :cms_image, to: :helpers
55

6-
def initialize(text_content:, image:, image_side:, image_link:, title:, background_color: nil, buttons: [], show_bottom_border: false)
6+
def initialize(text_content:, image:, image_side:, image_link:, title:, background_color: nil, buttons: [], show_bottom_border: false, i_belong_flag: false, corner_flourish: false)
77
@text_content = text_content
88
@image = image
99
@image_side = image_side
@@ -12,6 +12,8 @@ def initialize(text_content:, image:, image_side:, image_link:, title:, backgrou
1212
@background_color = background_color
1313
@buttons = buttons
1414
@show_bottom_border = show_bottom_border
15+
@i_belong_flag = i_belong_flag
16+
@corner_flourish = corner_flourish
1517
end
1618

1719
def wrapper_classes

app/components/cms/full_width_banner_component/full_width_banner_component.html.erb

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,17 @@
99

1010
<% if @image %>
1111
<div class="cms-full-width-banner__media">
12+
<% if @i_belong_flag %>
13+
<%= content_tag(:div, nil, class: "cms-full-width-banner__media--with-flag") %>
14+
<% end %>
15+
<% if @corner_flourish %>
16+
<%= content_tag(:div, nil, class: "cms-full-width-banner__media--with-flourish-#{@image_side}") %>
17+
<% end %>
1218
<%= render Cms::ImageComponent.new(@image, show_caption: false, link: @image_link) %>
1319
</div>
1420
<% end %>
1521

16-
<div class="cms-full-width-banner__content">
22+
<div class="cms-full-width-banner__content white-bg">
1723
<%= render @text_content.render %>
1824

1925
<% if @buttons %>
@@ -24,6 +30,7 @@
2430
</div>
2531
<% end %>
2632
</div>
33+
2734
<% end %>
2835
<% end %>
2936
<% end %>

app/components/cms/full_width_banner_component/full_width_banner_component.scss

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,83 @@
1212
}
1313

1414
.cms-full-width-banner {
15+
display: flex;
16+
flex-direction: row;
1517

1618
&.right-align {
1719
flex-direction: row-reverse;
1820
}
1921

20-
display: flex;
21-
22-
flex-direction: row;
23-
gap: 15px;
24-
2522
@include govuk-media-query($until: tablet) {
2623
flex-direction: column;
27-
gap: 0px;
24+
25+
&.right-align {
26+
flex-direction: column;
27+
}
2828
}
2929

3030
&__media {
3131
flex: 0 0 calc(100% * 1/3);
32-
padding: 10px;
32+
position: relative;
33+
34+
&--with-flag {
35+
position: absolute;
36+
top: 0;
37+
left: 5px;
38+
height: 97px;
39+
width: 79px;
40+
content: "";
41+
display: block;
42+
background-image: url("../images/logos/i_belong_flag.svg");
43+
background-size: 100%;
44+
background-repeat: no-repeat;
45+
}
46+
47+
&--with-flourish {
48+
position: relative;
49+
50+
&-left,
51+
&-right {
52+
position: absolute;
53+
bottom: 0;
54+
height: 163px;
55+
width: 162px;
56+
content: "";
57+
display: block;
58+
background-image: url("../images/components/cms/full_width_banner_component/flourish.svg");
59+
}
60+
61+
&-left {
62+
left: 0;
63+
}
64+
65+
&-right {
66+
right: 0;
67+
transform: scaleX(-1);
68+
}
69+
}
70+
71+
.cms-image {
72+
display: flex;
73+
width: 100%;
74+
height: 100%
75+
}
3376

3477
img {
3578
width: 100%;
79+
height: 100%;
80+
object-fit: cover;
3681
}
82+
3783
}
38-
84+
3985
&__content {
4086
flex: 1 1 calc(100% * 2/3);
41-
padding: 20px 0px;
87+
padding: 20px 20px;
4288

4389
.govuk-button {
4490
min-width: 300px;
4591
}
46-
4792
}
4893

49-
}
94+
}

app/components/cms/question_and_answer_component/question_and_answer_component.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ $avatar_size: 32px;
5353
bottom: 12px;
5454
left: -7px;
5555
box-sizing: border-box;
56-
56+
5757
border: 8px solid black;
5858
border-color: transparent transparent white white;
59-
59+
6060
transform-origin: center;
6161
transform: rotate(45deg);
6262
box-shadow: -4px 4px 6px -3px #0000004D;
@@ -116,10 +116,10 @@ $avatar_size: 32px;
116116
bottom: 12px;
117117
right: -7px;
118118
box-sizing: border-box;
119-
119+
120120
border: 8px solid black;
121121
border-color: transparent transparent white white;
122-
122+
123123
transform-origin: center;
124124
transform: rotate(-135deg);
125125
box-shadow: -4px 4px 6px -3px #0000004D;
@@ -133,7 +133,7 @@ $avatar_size: 32px;
133133
}
134134

135135
&.answer-with-background {
136-
background-image: url("../images/components/cms_question_and_answer_component/background_triangle.svg");
136+
background-image: url("../images/components/cms/question_and_answer_component/background_triangle.svg");
137137
background-position: top right;
138138
background-repeat: no-repeat;
139139
}
@@ -168,4 +168,4 @@ $avatar_size: 32px;
168168
}
169169
}
170170

171-
}
171+
}

app/services/cms/dynamic_components/full_width_banner.rb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
module Cms
22
module DynamicComponents
33
class FullWidthBanner
4-
attr_accessor :text_content, :image, :image_side, :buttons, :image_link, :title, :background_color, :show_bottom_border
4+
attr_accessor :text_content, :image, :image_side, :buttons, :image_link, :title, :background_color, :show_bottom_border, :i_belong_flag, :corner_flourish
55

6-
def initialize(text_content:, title:, image: nil, image_side: :left, image_link: nil, background_color: :white, buttons: [], show_bottom_border: false)
6+
def initialize(text_content:, title:, image: nil, image_side: :left, image_link: nil, background_color: :white, buttons: [], show_bottom_border: false, i_belong_flag: false, corner_flourish: false)
77
@text_content = text_content
88
@image = image
99
@image_side = image_side
@@ -12,6 +12,8 @@ def initialize(text_content:, title:, image: nil, image_side: :left, image_link:
1212
@title = title
1313
@buttons = buttons
1414
@show_bottom_border = show_bottom_border
15+
@i_belong_flag = i_belong_flag
16+
@corner_flourish = corner_flourish
1517
end
1618

1719
def render
@@ -23,7 +25,9 @@ def render
2325
background_color:,
2426
buttons:,
2527
title:,
26-
show_bottom_border:
28+
show_bottom_border:,
29+
i_belong_flag:,
30+
corner_flourish:
2731
)
2832
end
2933
end

app/services/cms/providers/strapi/factories/blocks_factory.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ def self.to_full_width_banner(strapi_data)
154154
image_link: strapi_data[:imageLink],
155155
buttons: strapi_data[:buttons] ? strapi_data[:buttons].map { to_ncce_button(_1) } : [],
156156
title: strapi_data[:sectionTitle],
157-
show_bottom_border: strapi_data[:showBottomBorder]
157+
show_bottom_border: strapi_data[:showBottomBorder],
158+
i_belong_flag: strapi_data[:iBelongFlag],
159+
corner_flourish: strapi_data[:imageCornerFlourish]
158160
)
159161
end
160162

Lines changed: 19 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)