Skip to content

Commit ee3ba4a

Browse files
committed
Refactored component to use shared css
Added css for background colours in rich text component
1 parent 8353943 commit ee3ba4a

File tree

5 files changed

+39
-47
lines changed

5 files changed

+39
-47
lines changed

app/components/cms/rich_text_block_component/rich_text_block_component.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,25 @@
9696
text-decoration: none;
9797
}
9898
}
99+
100+
.purple-bg {
101+
.cms-rich-text-block-component:not(.white-bg):not(.white-bg *) {
102+
.govuk-body-m, .govuk-body-s {
103+
color: $white;
104+
}
105+
}
106+
107+
.white-bg {
108+
.govuk-body-m, .govuk-body-s {
109+
color: $black;
110+
}
111+
}
112+
}
113+
114+
.isaac-bg {
115+
.cms-rich-text-block-component {
116+
a {
117+
color: $black;
118+
}
119+
}
120+
}

app/components/cms/two_column_video_section_component.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ def content_background_color_classes
1414
classes = []
1515

1616
if @box_color
17-
classes << "cms-two-column-video-section-component__wrapper--padded"
17+
classes << ["cms-two-column-video-section-component__wrapper--padded", "tc-row"]
1818
classes << "#{@box_color}-bg"
1919
else
20-
classes << "cms-two-column-video-section-component__wrapper"
20+
classes << ["cms-two-column-video-section-component__wrapper", "tc-row"]
2121
end
2222
classes
2323
end

app/components/cms/two_column_video_section_component/two_column_video_section_component.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<%= render GovGridRowComponent.new(background_color: @background_color, additional_classes: "cms-two-column-video-section-component") do |row| %>
22
<%= row.with_column("full") do %>
33
<%= content_tag :div, class: content_background_color_classes do %>
4-
<div class="cms-two-column-video-section-component__left-content">
4+
<div class="tc-row-half">
55
<%= render @left_column_content.render %>
66
<% if @left_column_button %>
77
<%= render @left_column_button.render %>
88
<% end %>
99
</div>
10-
<div class="cms-two-column-video-section-component__right-content">
10+
<div class="tc-row-half">
1111
<%= render @video.render %>
1212
<% if @right_column_content %>
1313
<div class="cms-two-column-video-section-component__right-text">
Lines changed: 7 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,17 @@
11
.cms-two-column-video-section-component {
2-
&__wrapper {
3-
display: flex;
4-
gap: 30px;
5-
6-
@include govuk-media-query($until: tablet) {
7-
flex-direction: column;
8-
gap: 15px;
9-
}
2+
video {
3+
width: 100%;
4+
height: auto;
5+
display: block;
6+
}
107

8+
&__wrapper {
119
&--padded {
12-
display: flex;
13-
gap: 30px;
1410
padding: 15px;
15-
16-
@include govuk-media-query($until: tablet) {
17-
flex-direction: column;
18-
gap: 15px;
19-
}
2011
}
2112
}
2213

23-
&__left-content {
24-
flex: 0 1 50%;
25-
26-
@include govuk-media-query($until: tablet) {
27-
width: 100%;
28-
}
29-
}
30-
31-
&__right {
32-
&-content {
33-
flex: 0 1 50%
34-
35-
video {
36-
width: 100%;
37-
height: auto;
38-
display: block;
39-
}
40-
41-
@include govuk-media-query($until: tablet) {
42-
width: 100%;
43-
}
44-
}
45-
46-
&-text {
14+
&__right-text {
4715
margin-top: 20px;
48-
}
4916
}
5017
}

app/webpacker/stylesheets/components/cms/_shared.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@
4646
.tc-row-one-third {
4747
flex: 1 1 calc(100% * 1/3);
4848
}
49-
49+
50+
.tc-row-half {
51+
flex: 0 1 50%;
52+
}
5053
}
5154

5255
.cms-icon-row {
@@ -68,12 +71,12 @@
6871
box-shadow: none;
6972
}
7073
}
71-
74+
7275
}
7376

7477
.cms-dynamic-zone--bottom-padding {
7578

7679
.tc-gov-grid-wrapper:last-child {
7780
padding-bottom: 40px;
7881
}
79-
}
82+
}

0 commit comments

Comments
 (0)