Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Embed): Add component #783

Merged
merged 2 commits into from
Nov 10, 2016
Merged

feat(Embed): Add component #783

merged 2 commits into from
Nov 10, 2016

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Nov 2, 2016

Fixes #191

@codecov-io
Copy link

codecov-io commented Nov 4, 2016

Current coverage is 100% (diff: 100%)

No coverage report found for master at 0185032.

Powered by Codecov. Last update 0185032...1d1af28

@layershifter layershifter force-pushed the feat/embed branch 3 times, most recently from 5da0b50 to 8f23956 Compare November 9, 2016 12:56
@layershifter
Copy link
Member Author

Rebased to latest master, we're ready for review 👍

/** Settings to configure video behavior. */
sourceSettings: customPropTypes.every([
customPropTypes.demand(['source']),
PropTypes.shape({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should flatten these settings as top level props, instead of a nested object. They are applicable only to embedded videos, but I don't think that warrants nesting these props. Let me know if you disagree and why.

{Icon.create(icon)}
{placeholder && <img className='placeholder' src={placeholder} />}

<EmbedEmbed active={active} src={this.getSource()}>{children}</EmbedEmbed>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that EmbedEmbed:

  1. used in only one place, in Embed
  2. only uses props from Embed
  3. is not an exposed sub component

I would suggest using a method instead of a new component:

renderEmbed = () => {
  const { active, children } = this.props
  if (!active) return null
  if (children) return <div className='embed'>{children}</div>

  return (
    <div className='embed'>
      <iframe
        allowFullScreen=''
        frameBorder='0'
        height='100%'
        scrolling='no'
        src={this.getSource()}
        width='100%'
      />
    </div>
  )
}

render() {
  return (
    // ...snip
    {this.renderEmbed}
  )
}

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add tests

feat(Embed): Add tests

feat(Embed): Add component

feat(Embed): Add component
@layershifter
Copy link
Member Author

Removed EmbedEmbed and updated tests, looks better 👍

sourceAutoPlay = true,
sourceBrandedUI = false,
sourceColor = '#444444',
sourceHd = true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, I'm have there same problems with demand like in #827, so I left values there instead of defaultProps.

]),

/** Specifies a url to use for embed. */
sourceUrl: customPropTypes.every([
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last update, can we remove the source prefixing from these props? I'm going for parity with the Semantic-UI core settings:

image

@levithomason
Copy link
Member

I'm preparing a release, so I'll go ahead and update the props :)

@layershifter
Copy link
Member Author

I'll updating it now 😄

@levithomason
Copy link
Member

Whoops, thanks for the rapid reply!

@levithomason
Copy link
Member

Perfect, will merge and cut a release when tests pass.

@levithomason levithomason deleted the feat/embed branch November 10, 2016 16:48
@levithomason
Copy link
Member

Released in semantic-ui-react@0.60.3

layershifter added a commit that referenced this pull request Nov 11, 2016
* feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add component

feat(Embed): Add tests

feat(Embed): Add tests

feat(Embed): Add component

feat(Embed): Add component

* feat(Embed): Update prop names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants