-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4767 from guardian/ash/FixedSmallSlowIV.tsx
feat: Add support for fixed/small/slow-IV container type
- Loading branch information
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
dotcom-rendering/src/web/components/FixedSmallSlowIV.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { breakpoints } from '@guardian/source-foundations'; | ||
import { ContainerLayout } from './ContainerLayout'; | ||
import { FixedSmallSlowIV } from './FixedSmallSlowIV'; | ||
|
||
import { trails } from '../../../fixtures/manual/trails'; | ||
|
||
export default { | ||
component: FixedSmallSlowIV, | ||
title: 'Components/FixedSmallSlowIV', | ||
parameters: { | ||
chromatic: { | ||
viewports: [ | ||
breakpoints.mobile, | ||
breakpoints.mobileMedium, | ||
breakpoints.mobileLandscape, | ||
breakpoints.phablet, | ||
breakpoints.tablet, | ||
breakpoints.desktop, | ||
breakpoints.leftCol, | ||
breakpoints.wide, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const Default = () => ( | ||
<ContainerLayout | ||
title="FixedSmallSlowIV" | ||
showTopBorder={true} | ||
sideBorders={true} | ||
padContent={false} | ||
centralBorder="partial" | ||
> | ||
<FixedSmallSlowIV trails={trails} /> | ||
</ContainerLayout> | ||
); | ||
Default.story = { name: 'FixedSmallSlowIV' }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ArticleDesign } from '@guardian/libs'; | ||
import { Card } from './Card/Card'; | ||
import { LI } from './Card/components/LI'; | ||
import { UL } from './Card/components/UL'; | ||
|
||
type Props = { | ||
trails: TrailType[]; | ||
}; | ||
|
||
export const FixedSmallSlowIV = ({ trails }: Props) => { | ||
const slicedTrails = trails.slice(0, 4); | ||
|
||
return ( | ||
<UL direction="row"> | ||
{slicedTrails.map((trail, index) => { | ||
return ( | ||
<LI | ||
padSides={true} | ||
showDivider={index > 0} | ||
padBottomOnMobile={true} | ||
> | ||
<Card | ||
linkTo={trail.url} | ||
format={trail.format} | ||
headlineText={trail.headline} | ||
trailText={trail.trailText} | ||
headlineSize="medium" | ||
byline={trail.byline} | ||
showByline={trail.showByline} | ||
showQuotes={ | ||
trail.format.design === ArticleDesign.Comment || | ||
trail.format.design === ArticleDesign.Letter | ||
} | ||
webPublicationDate={trail.webPublicationDate} | ||
kickerText={trail.kickerText} | ||
showPulsingDot={ | ||
trail.format.design === ArticleDesign.LiveBlog | ||
} | ||
showSlash={true} | ||
showClock={false} | ||
imageUrl={trail.image} | ||
imagePosition="top" | ||
imagePositionOnMobile="left" | ||
imageSize="medium" | ||
mediaType={trail.mediaType} | ||
mediaDuration={trail.mediaDuration} | ||
commentCount={trail.commentCount} | ||
starRating={trail.starRating} | ||
branding={trail.branding} | ||
/> | ||
</LI> | ||
); | ||
})} | ||
</UL> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters