-
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 branch 'main' into e2e/add-audio-player
- Loading branch information
Showing
14 changed files
with
483 additions
and
150 deletions.
There are no files selected for viewing
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
71 changes: 71 additions & 0 deletions
71
dotcom-rendering/src/components/Card/components/TrailText.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,71 @@ | ||
import { css } from '@emotion/react'; | ||
import { | ||
from, | ||
space, | ||
textSans14, | ||
textSans17, | ||
} from '@guardian/source/foundations'; | ||
import { Hide } from '@guardian/source/react-components'; | ||
import { palette } from '../../../palette'; | ||
|
||
export type TrailTextSize = 'regular' | 'large'; | ||
|
||
type Props = { | ||
trailText: string; | ||
trailTextSize?: TrailTextSize; | ||
/** Optionally overrides the trail text colour */ | ||
trailTextColour?: string; | ||
/** Controls visibility of trail text on various breakpoints */ | ||
hideUntil?: 'tablet' | 'desktop'; | ||
/** Adds padding to the top of the trail text */ | ||
padTop: boolean; | ||
}; | ||
|
||
const trailTextStyles = css` | ||
display: flex; | ||
flex-direction: column; | ||
padding-bottom: ${space[2]}px; | ||
`; | ||
|
||
const topPadding = css` | ||
padding-top: ${space[2]}px; | ||
`; | ||
|
||
const fontStyles = (trailTextSize: TrailTextSize) => css` | ||
${textSans14} | ||
${from.desktop} { | ||
${trailTextSize === 'large' && textSans17} | ||
} | ||
strong { | ||
font-weight: bold; | ||
} | ||
`; | ||
|
||
export const TrailText = ({ | ||
trailText: text, | ||
trailTextSize = 'regular', | ||
trailTextColour = palette('--card-trail-text'), | ||
hideUntil, | ||
padTop, | ||
}: Props) => { | ||
const trailText = ( | ||
<div | ||
css={[ | ||
trailTextStyles, | ||
css` | ||
color: ${trailTextColour}; | ||
`, | ||
fontStyles(trailTextSize), | ||
padTop && topPadding, | ||
]} | ||
dangerouslySetInnerHTML={{ | ||
__html: text, | ||
}} | ||
/> | ||
); | ||
return hideUntil ? ( | ||
<Hide until={hideUntil}>{trailText}</Hide> | ||
) : ( | ||
<>{trailText}</> | ||
); | ||
}; |
106 changes: 0 additions & 106 deletions
106
dotcom-rendering/src/components/Card/components/TrailTextWrapper.tsx
This file was deleted.
Oops, something went wrong.
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
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
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
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,22 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { UsEoy2024 } from './UsEoy2024Wrapper.importable'; | ||
|
||
const meta = { | ||
title: 'Components/UsEoy2024', | ||
component: UsEoy2024, | ||
} satisfies Meta<typeof UsEoy2024>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default = { | ||
args: { | ||
tickerData: { | ||
total: 1000000, | ||
goal: 2000000, | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
submitTrackingEvent: () => {}, | ||
}, | ||
} satisfies Story; |
Oops, something went wrong.