This repository has been archived by the owner on Aug 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Add story for Media Message component & remove border #3666
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f0738e8
Add media message component to storybook and remove strong border fro…
RichardPK 0a3d6a7
Added knobs to media message component
RichardPK cc4b867
Bumping versions
RichardPK d2f5e29
Created snapshot test for component in psammead
RichardPK 3230d1c
Add PR to changelog
RichardPK d046383
Merge branch 'latest' of github.com:bbc/psammead into remove-strong-b…
RichardPK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
74 changes: 74 additions & 0 deletions
74
packages/components/psammead-media-player/src/Message/__snapshots__/index.test.jsx.snap
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,74 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Media Message matches media message snapshot 1`] = ` | ||
.c0 { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
.c1 { | ||
font-family: Helmet,Freesans,Helvetica,Arial,sans-serif; | ||
font-weight: 400; | ||
font-style: normal; | ||
font-size: 0.9375rem; | ||
line-height: 1.125rem; | ||
width: 100%; | ||
height: 100%; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
border: 0.0625rem solid transparent; | ||
color: #FFFFFF; | ||
background-color: rgba(34,34,34,0.75); | ||
} | ||
|
||
.c2 { | ||
display: block; | ||
font-weight: normal; | ||
bottom: 0; | ||
position: absolute; | ||
padding: 0.5rem; | ||
} | ||
|
||
@media (min-width:37.5rem) { | ||
.c1 { | ||
font-size: 0.875rem; | ||
} | ||
} | ||
|
||
@media screen and (-ms-high-contrast:active) { | ||
.c1 { | ||
background-color: transparent; | ||
} | ||
} | ||
|
||
@media screen and (-ms-high-contrast:active) { | ||
.c2 { | ||
background-color: window; | ||
} | ||
} | ||
|
||
@media (min-width:25rem) { | ||
.c2 { | ||
padding: 1rem; | ||
} | ||
} | ||
|
||
<div | ||
class="c0" | ||
> | ||
|
||
<div | ||
class="c1" | ||
> | ||
<strong | ||
class="c2" | ||
> | ||
Контент більше не доступний | ||
</strong> | ||
</div> | ||
</div> | ||
`; |
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
32 changes: 20 additions & 12 deletions
32
packages/components/psammead-media-player/src/Message/index.test.jsx
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 |
---|---|---|
@@ -1,19 +1,27 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { shouldMatchSnapshot } from '@bbc/psammead-test-helpers'; | ||
import Message from './index'; | ||
import '@testing-library/jest-dom/extend-expect'; | ||
|
||
it('should display the media message', () => { | ||
const { getByText } = render( | ||
<Message | ||
service="news" | ||
message="Please enable Javascript or try a different browser" | ||
placeholderSrc="http://foo.bar/placeholder.png" | ||
placeholderSrcset="http://foo.bar/placeholder.png" | ||
/>, | ||
); | ||
const message = getByText( | ||
'Please enable Javascript or try a different browser', | ||
describe('Media Message', () => { | ||
it('should display the media message', () => { | ||
const { getByText } = render( | ||
<Message | ||
service="news" | ||
message="Please enable Javascript or try a different browser" | ||
placeholderSrc="http://foo.bar/placeholder.png" | ||
placeholderSrcset="http://foo.bar/placeholder.png" | ||
/>, | ||
); | ||
const message = getByText( | ||
'Please enable Javascript or try a different browser', | ||
); | ||
expect(message).toBeInTheDocument(); | ||
}); | ||
|
||
shouldMatchSnapshot( | ||
'matches media message snapshot', | ||
<Message message="Контент більше не доступний" service="ukrainian" />, | ||
); | ||
expect(message).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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering what 56.25% is for? This value seems unsual? Did we use this before this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a means of applying a 16:9 ratio to the container's padding. Where 16 is the width, 56.26% of that (9) is the height.
We use it in Simorgh as a means of pushing the other page content below the player - I'm just mocking that in the story to emulate the styling.
Frankly it seems like a mad way to manage layout but I'm sure there's good reason for doing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intersting, ok thanks for the explanation @RichardPK