-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'latest' into legacy-media-support
- Loading branch information
Showing
133 changed files
with
2,244 additions
and
12,185 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import BASE64_PLACEHOLDER_IMAGE from '#app/components/Image/base64Placeholder'; | ||
import { css, Theme } from '@emotion/react'; | ||
|
||
export default { | ||
ampIframeWrapper: ({ palette }: Theme) => | ||
css({ | ||
position: 'relative', | ||
overflow: 'hidden', | ||
backgroundColor: palette.LUNAR, | ||
height: '100%', | ||
}), | ||
ampIframePlaceholder: ({ mq }: Theme) => | ||
css({ | ||
backgroundImage: `url(${BASE64_PLACEHOLDER_IMAGE})`, | ||
backgroundPosition: 'center center', | ||
backgroundRepeat: ' no-repeat', | ||
backgroundSize: '60px 17px', | ||
|
||
[mq.GROUP_2_MIN_WIDTH]: { | ||
backgroundSize: ' 77px 22px', | ||
}, | ||
[mq.GROUP_4_MIN_WIDTH]: { | ||
backgroundSize: ' 93px 27px', | ||
}, | ||
}), | ||
}; |
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,38 @@ | ||
import React from 'react'; | ||
import { | ||
act, | ||
render, | ||
} from '#app/components/react-testing-library-with-providers'; | ||
import Amp from './index'; | ||
|
||
const mockAmpIframeUrl = 'https://www.bbc.com/news/av-embeds/123456789'; | ||
|
||
describe('Amp', () => { | ||
it('should render an amp-iframe with the correct attributes', async () => { | ||
let container; | ||
|
||
await act(async () => { | ||
({ container } = render(<Amp src={mockAmpIframeUrl} />)); | ||
}); | ||
|
||
const ampIframe = (container as unknown as HTMLElement).querySelector( | ||
'amp-iframe', | ||
); | ||
|
||
expect(ampIframe).toBeInTheDocument(); | ||
}); | ||
|
||
it('should render amp-iframe placeholder', async () => { | ||
let container; | ||
|
||
await act(async () => { | ||
({ container } = render(<Amp src={mockAmpIframeUrl} />)); | ||
}); | ||
|
||
const ampImg = (container as unknown as HTMLElement).querySelector( | ||
'amp-iframe > div', | ||
); | ||
|
||
expect(ampImg).toBeInTheDocument(); | ||
}); | ||
}); |
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,44 @@ | ||
import { css, Theme } from '@emotion/react'; | ||
|
||
const NOJS_BACKGROUND_COLOUR = 'rgba(34, 34, 34, 0.75)'; | ||
|
||
export default { | ||
messageWrapper: ({ fontVariants, fontSizes, palette, mq }: Theme) => | ||
css({ | ||
...fontVariants.sansRegular, | ||
...fontSizes.longPrimer, | ||
width: '100%', | ||
height: '100%', | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
border: `0.0625rem solid transparent`, | ||
color: palette.WHITE, | ||
backgroundColor: NOJS_BACKGROUND_COLOUR, | ||
|
||
[mq.FORCED_COLOURS]: { | ||
backgroundColor: 'transparent', | ||
}, | ||
}), | ||
message: ({ spacings, mq }: Theme) => | ||
css({ | ||
display: 'block', | ||
fontWeight: 'normal', | ||
bottom: 0, | ||
position: 'absolute', | ||
padding: `${spacings.FULL}rem`, | ||
[mq.GROUP_2_MIN_WIDTH]: { | ||
padding: `${spacings.DOUBLE}rem`, | ||
}, | ||
[mq.FORCED_COLOURS]: { | ||
backgroundColor: 'window', | ||
}, | ||
}), | ||
messageImage: () => | ||
css({ | ||
position: 'absolute', | ||
inset: 0, | ||
width: '100%', | ||
height: '100%', | ||
}), | ||
}; |
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,33 @@ | ||
/** @jsx jsx */ | ||
|
||
import { jsx } from '@emotion/react'; | ||
import styles from './index.styles'; | ||
|
||
type Props = { | ||
message?: string; | ||
placeholderSrc?: string; | ||
placeholderSrcset?: string; | ||
}; | ||
|
||
const Message = ({ | ||
message = '', | ||
placeholderSrc = '', | ||
placeholderSrcset = '', | ||
}: Props) => ( | ||
<div> | ||
{placeholderSrc && ( | ||
<img | ||
alt="" | ||
src={placeholderSrc} | ||
srcSet={placeholderSrcset} | ||
aria-hidden="true" | ||
css={styles.messageImage} | ||
/> | ||
)} | ||
<div css={styles.messageWrapper}> | ||
<strong css={styles.message}>{message}</strong> | ||
</div> | ||
</div> | ||
); | ||
|
||
export default Message; |
Oops, something went wrong.