Skip to content
This repository has been archived by the owner on Aug 13, 2023. It is now read-only.

Add guidance to Media player #2517

Merged
merged 52 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
47726d4
created guidance component
rhenshaw56 Oct 29, 2019
2147b4c
resolved conflicts
rhenshaw56 Oct 29, 2019
800ae81
added snapshots for guidaance coverage
rhenshaw56 Oct 29, 2019
093e40d
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Oct 29, 2019
a5b4ce7
bumped version
rhenshaw56 Oct 30, 2019
1c05ecc
removed typo
rhenshaw56 Oct 30, 2019
2199d9c
added tests for guidance component
rhenshaw56 Oct 30, 2019
b32d190
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Oct 30, 2019
c6643a3
removed type prop
rhenshaw56 Oct 30, 2019
f74319e
removed destructuring
rhenshaw56 Oct 30, 2019
e27d723
removed redundant styles and prop
rhenshaw56 Oct 30, 2019
7fc5434
updated snapshots
rhenshaw56 Oct 30, 2019
02cf1dc
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Oct 30, 2019
981f5e1
added adjustments
rhenshaw56 Oct 31, 2019
86ebc74
resolved conflicts
rhenshaw56 Oct 31, 2019
dec6e3a
updated snaps
rhenshaw56 Oct 31, 2019
835a6d6
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Oct 31, 2019
c304de7
Merge branch 'latest' into 3139_guidance
simonsinclair Oct 31, 2019
bc2a185
updated changelog
rhenshaw56 Oct 31, 2019
2a66419
used icon from psammead-assets
rhenshaw56 Oct 31, 2019
50d83a8
used icon from psammeadd-assets
rhenshaw56 Oct 31, 2019
44237cb
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Oct 31, 2019
869cc15
updated snaps
rhenshaw56 Oct 31, 2019
3306ada
Merge branch '3139_guidance' of github.com:bbc/psammead into 3139_gui…
rhenshaw56 Oct 31, 2019
34d2a9a
changed typography
rhenshaw56 Nov 1, 2019
271b919
updated snaps
rhenshaw56 Nov 1, 2019
f3aa02d
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Nov 1, 2019
f678f2d
adjustments
rhenshaw56 Nov 1, 2019
9274984
changed flex to grid
rhenshaw56 Nov 1, 2019
40034c3
updated snaps
rhenshaw56 Nov 1, 2019
42454f6
prop change in test
rhenshaw56 Nov 1, 2019
5c32f85
updated snaps due to test change
rhenshaw56 Nov 1, 2019
44b993b
made adjustments
rhenshaw56 Nov 1, 2019
7ff30c2
removed height
rhenshaw56 Nov 1, 2019
e074661
resolved conflicts
rhenshaw56 Nov 1, 2019
0be6fee
updated snaps
rhenshaw56 Nov 1, 2019
a2ba215
updated readme
rhenshaw56 Nov 4, 2019
9badfa0
resolved conflicts
rhenshaw56 Nov 4, 2019
7e51d9b
made styling adjustments
rhenshaw56 Nov 4, 2019
29a8741
updated snaps
rhenshaw56 Nov 4, 2019
42aaa21
resolved conflicts
rhenshaw56 Nov 4, 2019
00a66e3
Merge branch 'latest' into 3139_guidance
simonsinclair Nov 4, 2019
dd90448
removed typo
rhenshaw56 Nov 4, 2019
c49175e
updated snaps
rhenshaw56 Nov 4, 2019
684bee0
Merge branch '3139_guidance' of github.com:bbc/psammead into 3139_gui…
rhenshaw56 Nov 4, 2019
f24f2b3
Merge branch 'latest' of github.com:bbc/psammead into 3139_guidance
rhenshaw56 Nov 4, 2019
cc65a87
removed changes to readme
rhenshaw56 Nov 5, 2019
62f1bca
removed classname prop
rhenshaw56 Nov 5, 2019
730611f
Merge branch 'latest' into 3139_guidance
Nov 6, 2019
28c1951
Merge branch 'latest' into 3139_guidance
Nov 6, 2019
ebec2bd
resolved conflicts
rhenshaw56 Nov 6, 2019
24b907b
Merge branch '3139_guidance' of github.com:bbc/psammead into 3139_gui…
rhenshaw56 Nov 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/psammead-media-player/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<!-- prettier-ignore -->
| Version | Description |
| ------- | ----------- |
| 2.2.0 | [PR#2517](https://github.com/bbc/psammead/pull/2517) Add Guidance to media placeholder image |
| 2.1.4 | [PR#2516](https://github.com/bbc/psammead/pull/2516) Add notes to stories. Fix prop-type warnings |
| 2.1.3 | [PR#2542](https://github.com/bbc/psammead/pull/2542) Talos - Bump Dependencies - @bbc/psammead-play-button |
| 2.1.2 | [PR#2467](https://github.com/bbc/psammead/pull/2476) Update image `alt` to be empty for Media Player placeholder |
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/components/psammead-media-player/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bbc/psammead-media-player",
"version": "2.1.4",
"version": "2.2.0",
"description": "Provides a media player with optional placeholder",
"main": "dist/index.js",
"module": "esm/index.js",
Expand Down Expand Up @@ -29,6 +29,7 @@
"styled-components": "^4.3.2"
},
"dependencies": {
"@bbc/psammead-assets": "^2.7.0",
"@bbc/psammead-image": "^1.2.3",
"@bbc/psammead-play-button": "^1.0.0"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Media Player: Guidance should render Guidance 1`] = `
.c4 {
vertical-align: middle;
margin: 0 0.25rem;
color: #222222;
fill: currentColor;
width: 1rem;
height: 1rem;
}

.c0 {
font-family: ReithSans,Helvetica,Arial,sans-serif;
font-weight: 400;
font-style: normal;
font-size: 0.9375rem;
line-height: 1.125rem;
}

.c1 {
width: 100%;
height: 100%;
position: absolute;
background-color: rgba(34,34,34,0.75);
color: #FFFFFF;
}

.c2 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-align-items: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
padding: 1rem;
}

.c5 {
padding-left: 0.25rem;
font-weight: normal;
}

.c3 > svg {
color: #FFFFFF;
fill: currentColor;
height: 1.5rem;
width: 1.5rem;
}

@media (min-width:37.5rem) {
.c0 {
font-size: 0.875rem;
}
}

<div
class="c0"
>
<div
class="c1"
>
<div
class="c2"
>
<div
aria-hidden="true"
class="c3"
>
<svg
class="c4"
focusable="false"
height="32"
viewBox="0 0 32 32"
width="32"
>
<path
d="M32,16A16,16,0,1,1,16,0,16,16,0,0,1,32,16Zm-8.6-.8H16.6v3.1h2.9c-.2,1.5-1.6,2.4-3.7,2.4s-3.7-2.4-3.7-4.7,1-4.7,3.7-4.7,3,.8,3.2,2.2h4.2c-.4-4-3.9-5.8-7.2-5.8-4.8,0-8,3.7-8,8.3s3.1,8.3,8,8.3a5.4,5.4,0,0,0,4.5-2.1l.2,1.7h2.7Z"
/>
</svg>
</div>
<strong
class="c5"
>
Guidance: Contains strong language with adult humor
</strong>
</div>
</div>
<p>
within the guidance container
</p>
</div>
`;
73 changes: 73 additions & 0 deletions packages/components/psammead-media-player/src/Guidance/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import React from 'react';
import { string, node } from 'prop-types';
import styled from 'styled-components';
import { C_WHITE } from '@bbc/psammead-styles/colours';
import { mediaIcons } from '@bbc/psammead-assets/svgs';
import {
GEL_SPACING_DBL,
GEL_SPACING_TRPL,
GEL_SPACING_HLF,
} from '@bbc/gel-foundations/spacings';
import { GEL_LONG_PRIMER } from '@bbc/gel-foundations/typography';
import { getSansRegular } from '@bbc/psammead-styles/font-styles';

const GUIDANCE_BACKGROUND = 'rgba(34, 34, 34, 0.75)';

const StyledGuidance = styled.div`
${({ service }) => getSansRegular(service)}
${GEL_LONG_PRIMER};
`;

const GuidanceWrapper = styled.div`
simonsinclair marked this conversation as resolved.
Show resolved Hide resolved
width: 100%;
height: 100%;
position: absolute;
background-color: ${GUIDANCE_BACKGROUND};
color: ${C_WHITE};
`;

const Content = styled.div`
display: flex;
align-items: center;
padding: ${GEL_SPACING_DBL};
`;

const GuidanceMessage = styled.strong`
padding-left: ${GEL_SPACING_HLF};
font-weight: normal;
`;

const IconWrapper = styled.div`
> svg {
color: ${C_WHITE};
fill: currentColor;
height: ${GEL_SPACING_TRPL};
width: ${GEL_SPACING_TRPL};
}
`;

const Guidance = ({ guidanceMessage, service, children }) => {
return (
<StyledGuidance service={service}>
simonsinclair marked this conversation as resolved.
Show resolved Hide resolved
simonsinclair marked this conversation as resolved.
Show resolved Hide resolved
<GuidanceWrapper>
<Content>
<IconWrapper aria-hidden="true">{mediaIcons.guidance}</IconWrapper>
<GuidanceMessage>{guidanceMessage}</GuidanceMessage>
</Content>
</GuidanceWrapper>
{children}
</StyledGuidance>
);
};

Guidance.propTypes = {
guidanceMessage: string.isRequired,
service: string.isRequired,
children: node,
};

Guidance.defaultProps = {
children: null,
};

export default Guidance;
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { shouldMatchSnapshot } from '@bbc/psammead-test-helpers';
import Guidance from '.';

describe('Media Player: Guidance', () => {
shouldMatchSnapshot(
'should render Guidance',
<Guidance
guidanceMessage="Guidance: Contains strong language with adult humor"
service="news"
>
<p>within the guidance container</p>
</Guidance>,
);
});
Loading