11import { css } from '@emotion/react' ;
22import {
3- palette as sourcePalette ,
3+ from ,
44 space ,
55 textSans17 ,
66 textSansBold20 ,
@@ -12,26 +12,27 @@ import { HostedContentOnwardsCard } from './HostedContentOnwardsCard';
1212type HostedContentOnwardsProps = {
1313 trails : TrailType [ ] ;
1414 brandName : string ;
15+ isGalleryPage : boolean ;
1516} ;
1617
18+ /**
19+ * Override --accent-colour variable at a higher CSS specificity
20+ * for hosted gallery articles only, because this only has a dark design
21+ */
22+ const galleryOverrides = css `
23+ --accent-colour : ${ palette ( '--onward-text' ) } ;
24+ ` ;
25+
1726const headerStyles = css `
1827 margin-bottom : ${ space [ 1 ] } px;
19- border-top : ${ space [ 2 ] } px solid
20- var (--accent-colour , ${ sourcePalette . neutral [ 86 ] } );
28+ border-top : ${ space [ 2 ] } px solid var (--accent-colour , var (--onward-text ));
2129` ;
2230
2331const headingStyles = css `
2432 ${ textSans17 }
2533 padding-top : ${ space [ 2 ] } px;
26- color : ${ palette ( '--hosted-content-onwards-heading' ) } ;
27-
28- @media (prefers-color-scheme : dark) {
29- color : ${ palette ( '--hosted-content-onwards-heading' ) } ;
30- }
31-
32- [data-color-scheme = 'dark' ] & {
33- color : ${ palette ( '--hosted-content-onwards-heading' ) } ;
34- }
34+ padding-bottom : ${ space [ 2 ] } px;
35+ color : ${ palette ( '--onward-text' ) } ;
3536
3637 span {
3738 ${ textSansBold20 }
@@ -47,37 +48,71 @@ const stackedCardsStyles = css`
4748
4849const stackedCardWrapper = css `
4950 width : 100% ;
50- border-top : 2px solid ${ palette ( '--onward-content-border' ) } ;
51- padding-top : ${ space [ 2 ] } px;
52- padding-bottom : ${ space [ 2 ] } px;
51+ border-top : 1px solid ${ palette ( '--article-border' ) } ;
52+ padding : ${ space [ 2 ] } px 0 ;
5353
5454 & : last-of-type {
55- padding-bottom : 0 ;
55+ padding : ${ space [ 2 ] } px 0 0 0 ;
56+ }
57+ ` ;
58+
59+ const rowCardWrapper = css `
60+ ${ stackedCardWrapper }
61+ ${ from . desktop } {
62+ width : 100% ;
63+ border-top : none;
64+ border-right : 1px solid ${ palette ( '--article-border' ) } ;
65+ padding : 0 ${ space [ 2 ] } px;
66+
67+ & : first-of-type {
68+ padding : 0 ${ space [ 2 ] } px 0 0 ;
69+ }
70+ & : last-of-type {
71+ border-right : none;
72+ padding : 0 0 0 ${ space [ 2 ] } px;
73+ }
74+ }
75+ ` ;
76+
77+ const galleryStyles = css `
78+ ${ from . desktop } {
79+ flex-direction : row;
5680 }
5781` ;
5882
5983export const HostedContentOnwards = ( {
6084 trails,
6185 brandName,
86+ isGalleryPage = false ,
6287} : HostedContentOnwardsProps ) => {
6388 return (
64- < >
89+ < div css = { isGalleryPage && galleryOverrides } >
6590 < header css = { headerStyles } >
6691 < h2 css = { headingStyles } >
6792 More from
6893 < span > { brandName } </ span >
6994 </ h2 >
7095 </ header >
7196
72- < ul css = { stackedCardsStyles } >
97+ < ul css = { [ stackedCardsStyles , isGalleryPage && galleryStyles ] } >
7398 { trails . map ( ( trail ) => {
7499 return (
75- < li key = { trail . url } css = { stackedCardWrapper } >
76- < HostedContentOnwardsCard trail = { trail } />
100+ < li
101+ key = { trail . url }
102+ css = {
103+ isGalleryPage
104+ ? rowCardWrapper
105+ : stackedCardWrapper
106+ }
107+ >
108+ < HostedContentOnwardsCard
109+ trail = { trail }
110+ isGalleryPage = { isGalleryPage }
111+ />
77112 </ li >
78113 ) ;
79114 } ) }
80115 </ ul >
81- </ >
116+ </ div >
82117 ) ;
83118} ;
0 commit comments