Skip to content

Commit

Permalink
feat(Embed): disable "related videos" when brandedUI is set to `tru…
Browse files Browse the repository at this point in the history
…e` (#2320)

* disables YouTube "related videos" when `brandedUI` is set to `true`

* mixed(Embed): update tests and examples

* style(Embed): add trailing dot
  • Loading branch information
bennettrogers authored and layershifter committed Nov 15, 2017
1 parent 6ef5af5 commit bf27992
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { Embed } from 'semantic-ui-react'
const EmbedExampleIframe = () => (
<Embed
autoplay={false}
brandedUI={false}
color='white'
hd={false}
id='gJscrxxl_Bg'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Embed } from 'semantic-ui-react'
const EmbedExampleSettings = () => (
<Embed
autoplay={false}
brandedUI={false}
brandedUI
color='white'
hd={false}
id='D0WnZyxp_Wo'
Expand Down
2 changes: 1 addition & 1 deletion src/modules/Embed/Embed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface EmbedProps {
/** Initial value of active. */
defaultActive?: boolean;

/** Whether to show networks branded UI like title cards, or after video calls to action. */
/** Whether to prefer HD content. */
hd?: boolean;

/** Specifies an icon to use with placeholder content. */
Expand Down
3 changes: 2 additions & 1 deletion src/modules/Embed/Embed.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class Embed extends Component {
/** Initial value of active. */
defaultActive: PropTypes.bool,

/** Whether to show networks branded UI like title cards, or after video calls to action. */
/** Whether to prefer HD content. */
hd: customPropTypes.every([
customPropTypes.demand(['source']),
PropTypes.bool,
Expand Down Expand Up @@ -136,6 +136,7 @@ export default class Embed extends Component {
`&amp;hq=${hd}`,
'&amp;jsapi=false',
`&amp;modestbranding=${brandedUI}`,
`&amp;rel=${brandedUI ? 0 : 1}`,
].join('')
}

Expand Down
7 changes: 6 additions & 1 deletion test/specs/modules/Embed/Embed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ describe('Embed', () => {
})

describe('brandedUI', () => {
it('generates url part for source', () => {
it('generates "modestbranding" url parameter', () => {
assertIframeSrc({ brandedUI: true }, '&amp;modestbranding=true')
assertIframeSrc({ brandedUI: false }, '&amp;modestbranding=false')
})

it('generates "rel" url parameter', () => {
assertIframeSrc({ brandedUI: true }, '&amp;rel=0')
assertIframeSrc({ brandedUI: false }, '&amp;rel=1')
})
})

describe('color', () => {
Expand Down

0 comments on commit bf27992

Please sign in to comment.