@@ -25,12 +25,55 @@ type StorylinesSectionProps = {
2525 containerId ?: string ;
2626 editionId : EditionId ;
2727 storylinesContent ?: StorylinesContent ;
28+ pillar ?: string ;
2829} ;
2930
30- const categoryTitleCss = css `
31+ const setSelectedStorylineColour = ( pillar ?: string ) => {
32+ switch ( pillar ?. toLowerCase ( ) ) {
33+ case 'news' :
34+ return sourcePalette . news [ 400 ] ;
35+ case 'opinion' :
36+ return sourcePalette . opinion [ 400 ] ;
37+ case 'sport' :
38+ return sourcePalette . sport [ 400 ] ;
39+ case 'culture' :
40+ return sourcePalette . culture [ 400 ] ;
41+ case 'lifestyle' :
42+ return sourcePalette . lifestyle [ 400 ] ;
43+ default :
44+ return sourcePalette . news [ 400 ] ;
45+ }
46+ } ;
47+
48+ const selectedTitleStyles = ( selectedStorylineColour : string ) => css `
49+ ${ textSansBold34 }
50+ color : ${ selectedStorylineColour } ;
51+ margin-bottom : ${ space [ 4 ] } px;
52+ margin-top : ${ space [ 2 ] } px;
53+ padding-left : 10px ; /* aligns with the headlines of the stories below */
54+ ` ;
55+
56+ const setCategoryColour = ( pillar ?: string ) => {
57+ switch ( pillar ?. toLowerCase ( ) ) {
58+ case 'news' :
59+ return sourcePalette . news [ 300 ] ;
60+ case 'opinion' :
61+ return sourcePalette . opinion [ 400 ] ;
62+ case 'sport' :
63+ return sourcePalette . sport [ 300 ] ;
64+ case 'culture' :
65+ return sourcePalette . culture [ 300 ] ;
66+ case 'lifestyle' :
67+ return sourcePalette . lifestyle [ 300 ] ;
68+ default :
69+ return sourcePalette . news [ 300 ] ;
70+ }
71+ } ;
72+
73+ const categoryTitleCss = ( pillarColour : string ) => css `
3174 ${ textSans20 } ;
3275 font- weight: 700;
33- color : ${ sourcePalette . news [ 300 ] } ;
76+ color : ${ pillarColour } ;
3477 margin: ${ space [ 2 ] } px 0;
3578 padding: ${ space [ 2 ] } px 0;
3679 ${ from . tablet } {
@@ -67,7 +110,7 @@ const tabStyles = (isActive: boolean, isFirst: boolean) => css`
67110 bor der: none;
68111 ${ ! isFirst && `border-left: 1px ${ sourcePalette . neutral [ 86 ] } solid;` }
69112 color : ${ isActive
70- ? `${ sourcePalette . news [ 400 ] } `
113+ ? `${ sourcePalette . neutral [ 60 ] } `
71114 : `${ sourcePalette . neutral [ 38 ] } ` } ;
72115 flex: 1;
73116 min- width: 0;
@@ -79,15 +122,7 @@ const contentStyles = css`
79122 padding- to p: ${ space [ 0 ] } px 0;
80123` ;
81124
82- const selectedTitleStyles = css `
83- ${ textSansBold34 }
84- color : ${ sourcePalette . news [ 400 ] } ;
85- margin- botto m: ${ space [ 4 ] } px;
86- margin- to p: ${ space [ 2 ] } px;
87- padding- left: 10px; /* aligns with the headlines of the stories below */
88- ` ;
89-
90- const numberStyles = ( ) => css `
125+ const numberStyles = css `
91126 ${ headlineLight50 }
92127 line-height: 2rem; /* to align the number with the top of the text */
93128 margin- left: - ${ space [ 1 ] } px;
@@ -151,6 +186,7 @@ export const StorylinesSectionContent = ({
151186 containerId,
152187 storylinesContent,
153188 editionId,
189+ pillar,
154190} : StorylinesSectionProps ) => {
155191 const parsedStorylines =
156192 storylinesContent &&
@@ -168,6 +204,10 @@ export const StorylinesSectionContent = ({
168204 ( s ) => s . id === activeStorylineId ,
169205 ) ;
170206
207+ const selectedStorylineColour = setSelectedStorylineColour ( pillar ) ;
208+
209+ const categoryColour = setCategoryColour ( pillar ) ;
210+
171211 return (
172212 < >
173213 < StorylinesSection
@@ -204,25 +244,10 @@ export const StorylinesSectionContent = ({
204244 >
205245 { activeStorylineId === storyline . id ? (
206246 < >
207- < span
208- css = { [
209- numberStyles ,
210- css `
211- color : ${ sourcePalette
212- . neutral [ 60 ] } ;
213- ` ,
214- ] }
215- >
247+ < span css = { [ numberStyles ] } >
216248 { i + 1 }
217249 </ span >
218- < span
219- css = { css `
220- color : ${ sourcePalette
221- . neutral [ 60 ] } ;
222- ` }
223- >
224- { storyline . title }
225- </ span >
250+ < span > { storyline . title } </ span >
226251 </ >
227252 ) : (
228253 < >
@@ -236,14 +261,18 @@ export const StorylinesSectionContent = ({
236261 </ div >
237262 { /* Active storyline title */ }
238263 { activeStoryline && (
239- < div css = { selectedTitleStyles } > { activeStoryline . title } </ div >
264+ < div css = { selectedTitleStyles ( selectedStorylineColour ) } >
265+ { activeStoryline . title }
266+ </ div >
240267 ) }
241268 { /* Content by categories */ }
242269 < div css = { contentStyles } >
243270 { activeStoryline ?. categories . map ( ( category , idx ) => (
244271 < div key = { idx } css = { contentCss } >
245272 { category . title !== 'Key Stories' && (
246- < h2 css = { categoryTitleCss } > { category . title } </ h2 >
273+ < h2 css = { categoryTitleCss ( categoryColour ) } >
274+ { category . title }
275+ </ h2 >
247276 ) }
248277 < FlexibleGeneral
249278 groupedTrails = { category . groupedTrails }
0 commit comments