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(Advertisement): add new component #1292

Merged

Conversation

tarang9211
Copy link
Contributor

@tarang9211 tarang9211 commented Feb 6, 2017

Fixes #185

@codecov-io
Copy link

codecov-io commented Feb 6, 2017

Codecov Report

Merging #1292 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1292      +/-   ##
==========================================
+ Coverage   99.74%   99.74%   +<.01%     
==========================================
  Files         140      141       +1     
  Lines        2347     2354       +7     
==========================================
+ Hits         2341     2348       +7     
  Misses          6        6
Impacted Files Coverage Δ
src/views/Advertisement/Advertisement.js 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b12a368...d3ec665. Read the comment docs.

@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 6, 2017

Can someone giving feedback on this? I have 4 tests that need to pass, also need more info about the workings of this component.

@layershifter or @levithomason could you give some feedback?

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@tarang9211 I've left some comments, but all of them is about styling. You're on right way 👍

I could say more on the case, after you will add the some examples in the docs.

src/index.js Outdated
@@ -139,6 +139,8 @@ export { default as SidebarPushable } from './modules/Sidebar/SidebarPushable'
export { default as SidebarPusher } from './modules/Sidebar/SidebarPusher'

// Views
export { default as Advertisement } from './views/Advertisement/Advertisement'

Copy link
Member

Choose a reason for hiding this comment

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

Unnecessary blank line.

} from '../../lib'

/**
*An ad displays third-party promotional content
Copy link
Member

Choose a reason for hiding this comment

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

Missing gap and dot:

- *An ad displays third-party promotional content
+* An ad displays third-party promotional content.

@@ -0,0 +1,40 @@
import React, { PropTypes } from 'react'
import cx from 'classnames'
Copy link
Member

Choose a reason for hiding this comment

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

We sort imports in last PRs:

-import React, { PropTypes } from 'react'
-import cx from 'classnames'
+import cx from 'classnames'
+import React, { PropTypes } from 'react'

)
const ElementType = getElementType(Advertisement, props)

return <ElementType className={classes} />
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 that this component will have children?

Copy link
Member

Choose a reason for hiding this comment

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

Also, to get test working you need use there getUnhandledProps function and spread rest to ElementType.

Copy link
Member

Choose a reason for hiding this comment

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

And you need to add _meta of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added the meta property here: https://github.com/tarang9211/Semantic-UI-React/blob/5e34b354fcbd0a9da6847893c96172bac4564dee/src/views/Advertisement/Advertisement.js#L27 I was referring to the Feed component and structuring it that way. I'll push a new commit with your changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What should be the children of this component? If I had the line below, about 11 tests fail

if (!_.isNil(children)) {
    return <ElementType {...rest} className={classes}>{children}</ElementType>
  }

@layershifter layershifter changed the title (new-component): added boilerplate code for new advertisement component feat(Advertisement): add new component Feb 7, 2017
@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 7, 2017

@layershifter pushed a new commit with your changes. Here's a screenshot of the test that fails.

screen shot 2017-02-07 at 2 58 51 pm

Im defining the _meta property as per this - https://github.com/Semantic-Org/Semantic-UI-React/blob/master/src/views/Statistic/Statistic.js#L58

@layershifter
Copy link
Member

I've pushed some commits, tests are passed 👍

@tarang9211
Copy link
Contributor Author

@layershifter checked them out right now. Don't we also need a nil check for children?

@tarang9211
Copy link
Contributor Author

@layershifter could we create like a to-do for this task? That would help knocking things off. Let me know your thoughts.

@layershifter
Copy link
Member

layershifter commented Feb 8, 2017

Don't we also need a nil check for children?

Nope.

could we create like a to-do for this task?

Let's implement examples from SUI docs.

@tarang9211
Copy link
Contributor Author

@layershifter hmm alright. So are we handling the various sizes via props?

@tarang9211
Copy link
Contributor Author

Let me know if you think these are on point and what you're looking for!

@layershifter
Copy link
Member

@tarang9211 I'll take a look today.

@layershifter
Copy link
Member

layershifter commented Feb 8, 2017

Okay, as I see we have following units:

  • (mobile, large) leaderboard;
  • (medium, large) rectangle;
  • half page;
  • (small) square;
  • (small, vertical) rectangle;
  • (small, square) button;
  • (wide) skyscrape;
  • (vertical, top, half, large mobile) banner;
  • billboard;
  • panorama;
  • netboard.

Other props:

  • centered;
  • test.

Thoughts

All unit props will be separate:

leaderboard: PropTypes.oneOfType(
  PropTypes.bool,
  PropTypes.oneOf(['mobile', 'large'])
),
panorama: PropTypes.bool,

Also, as I see we cannot combile units, so they must also be single:

panorama: customPropTypes.every([
  customPropTypes.disallow(['leaderboard']),
  customPropTypes.disallow(['button']),
  // ...
  PropTypes.node,
])

Test will be combo-prop:

test: PropTypes.oneOfType(
  PropTypes.bool,
  PropTypes.number,
  PropTypes.string,
)
<Ad test/> // => <div class="ui test ad"></div>
<Ad test='hi' /> // => <div class="ui test ad" data-text="Ad Unit 2"></div>

@levithomason Other ideas?

@tarang9211
Copy link
Contributor Author

Thanks for the input I'll get to this in a few

@jeffcarbs
Copy link
Member

@layershifter - Given that the different "units" only affect height/width and thus can't be combined, I consider "unit" a single prop with different possible values. I think it should be similar to https://github.com/Semantic-Org/Semantic-UI-React/blob/master/src/collections/Grid/Grid.js#L121-L123

I took the values from the CSS file you linked, so it'd be:

unit: PropTypes.oneOf([
  'banner', 'half banner', 'large mobile banner' 'top banner', 'vertical banner'
  'billboard',
  'button', 'square button', 'small button',
  'half page',
  'small rectangle', 'medium rectangle', 'large rectangle', 'vertical rectangle',
  'leaderboard', 'large leaderboard', 'mobile leaderboard',
  'netboard',
  'panorama',
  'skyscraper', 'wide skyscraper',
  'square', 'small square'
])

@layershifter
Copy link
Member

@jcarbo good suggestion, I like it 👍

@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 8, 2017

Pushing a commit with @jcarbo's suggestions!

Could someone explain what test prop is really? Right now I'm seeing this on my local doc site examples and I don't know where it gets the Ad text from.

screen shot 2017-02-09 at 12 24 32 am

@tarang9211
Copy link
Contributor Author

@levithomason let me know what you think of the changes I made.

@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 14, 2017 via email

@levithomason
Copy link
Member

Checking into it, I think it is style related.

Also, the ad only loads on page refresh. If you navigate from, say the button docs, to the advertisement docs, the ad doesn't load (at least for me)

@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 14, 2017 via email

@levithomason
Copy link
Member

I think the size issue is due to the style prop, using this style prop from the SUI core example:

style={{ display: 'inline-block', width: 300, height: 250 }}

I get these results:

http://g.recordit.co/xd7LreHpJ4.gif

I am not sure on the mounting problem.

@levithomason
Copy link
Member

Unfortunately, that's all the time I have for now on this one. I'll check back here later and see where we are at with the mounting issue. That is the final issue to solve I believe, everything else is looking great.

@tarang9211
Copy link
Contributor Author

Interesting. Sounds good, let me know your findings. Let's try to get this merged soon!

@tarang9211
Copy link
Contributor Author

@layershifter Could you help look into this? We're pretty close to a merge

@tarang9211
Copy link
Contributor Author

tarang9211 commented Feb 18, 2017

@levithomason I suggest we revert the changes we made regarding the Adsense and have it be like what @layershifter did here. That's how everyone seems to be implementing the Adsense with React. Thoughts?

I don't think we faced any issues with that method of implementation.

@levithomason
Copy link
Member

OK, let's give it a try. Whatever solves the problem is the correct answer :)

@tarang9211
Copy link
Contributor Author

@levithomason Could you take a look at it? I'm looking at the Checkbox issue(s) currently. Let me know if that's not feasible.

Copy link
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

@levithomason I've updated typings structure and reverted standart example. LGTM, I think we ready to go 🚤

@tarang9211
Copy link
Contributor Author

@layershifter Thanks for getting to this! Appreciate the help

@levithomason levithomason merged commit d780270 into Semantic-Org:master Mar 3, 2017
@levithomason
Copy link
Member

Nice work fellas! 🎉

harel pushed a commit to harel/Semantic-UI-React that referenced this pull request Mar 8, 2017
* (new-componenet): added boilerplate code for new advertisement component

* (advertisement-component): added conformance test, but failing.

* (feat): fixedcode styling issues, 1 test failing

* test(Advertisement): add children test

* fix(Advertisement): fix typo

* fix(Advertisement): fix lint issue

* fix(Advertisement): added doc site example for medium, rectangle props

* test(Advertisement): added test case for advertisement component

* fix(Advertisement): fixed propTypes

* fix(Advertisement): fixed displaying text on the ad

* fix(Advertisement): fix typos and added props for centered

* fix(Advertisement): added tests

* fix(Advertisement): added test for unit prop

* fix(Advertisement): added line break

* fix(Advertisement): fixed code styling issues in src and test folder

* fix(Advertisement): modified doc site examples for advertisement

* docs(Advertisement): added example for all advertisement types

* docs(Advertisement): added doc site examples for advertisement variations

* docs(Advertisement): added doc site examples for mobile advertisement types

* fix(Advertisement): fixed code styling

* fix(Advertisement): fixed doc site code styling and files for advertisement banner

* style(Advertisment): fix spacing

* fix(Advertisement): fix dots

* fix(Advertisement)

* style(Advertisement): fix dots

* style(Advertisement): fix import order

* style(Advertisment): fix spacing

* style(Advertisement): fix order

* style(Advertisement): fixed files for rectangle advertisement

* style(Advertisement): fixed files for square advertisements

* style(Advertisement): fixed files for skyscraper advertisements

* style(Advertisement): fixed files for leaderboard advertisement

* style(Advertisement): fixed files for square advertisement

* fix(Advertisement): added large rectangle example to common units

* fix(Advertisement): fixed order of example as per SUI website

* fix(Advertisement): removed extra item in test variation advertisement

* fix(Advertisement): fixed typo

* fix(Advertisement): added typings for Advertisement

* style(Advertisement): fixed lint error

* fix(Advertisement): displaying google adsense examples as standard ads

* fix(Advertisement): removed setTimeout, using window.onload instead

* style(Adv): multiple fixes

* style(Adv): typings fixes

* style(Advertisement): fixed code styling

* style(Advertisement): removed async attribute from script tag

* fix(Advertisement): fixed google ads code

* docs(Advertisement): minor grammar correction'

* docs(Advertisement): fix lint issue

* style(Advertisement): update typings, example
harel pushed a commit to harel/Semantic-UI-React that referenced this pull request Mar 8, 2017
* (new-componenet): added boilerplate code for new advertisement component

* (advertisement-component): added conformance test, but failing.

* (feat): fixedcode styling issues, 1 test failing

* test(Advertisement): add children test

* fix(Advertisement): fix typo

* fix(Advertisement): fix lint issue

* fix(Advertisement): added doc site example for medium, rectangle props

* test(Advertisement): added test case for advertisement component

* fix(Advertisement): fixed propTypes

* fix(Advertisement): fixed displaying text on the ad

* fix(Advertisement): fix typos and added props for centered

* fix(Advertisement): added tests

* fix(Advertisement): added test for unit prop

* fix(Advertisement): added line break

* fix(Advertisement): fixed code styling issues in src and test folder

* fix(Advertisement): modified doc site examples for advertisement

* docs(Advertisement): added example for all advertisement types

* docs(Advertisement): added doc site examples for advertisement variations

* docs(Advertisement): added doc site examples for mobile advertisement types

* fix(Advertisement): fixed code styling

* fix(Advertisement): fixed doc site code styling and files for advertisement banner

* style(Advertisment): fix spacing

* fix(Advertisement): fix dots

* fix(Advertisement)

* style(Advertisement): fix dots

* style(Advertisement): fix import order

* style(Advertisment): fix spacing

* style(Advertisement): fix order

* style(Advertisement): fixed files for rectangle advertisement

* style(Advertisement): fixed files for square advertisements

* style(Advertisement): fixed files for skyscraper advertisements

* style(Advertisement): fixed files for leaderboard advertisement

* style(Advertisement): fixed files for square advertisement

* fix(Advertisement): added large rectangle example to common units

* fix(Advertisement): fixed order of example as per SUI website

* fix(Advertisement): removed extra item in test variation advertisement

* fix(Advertisement): fixed typo

* fix(Advertisement): added typings for Advertisement

* style(Advertisement): fixed lint error

* fix(Advertisement): displaying google adsense examples as standard ads

* fix(Advertisement): removed setTimeout, using window.onload instead

* style(Adv): multiple fixes

* style(Adv): typings fixes

* style(Advertisement): fixed code styling

* style(Advertisement): removed async attribute from script tag

* fix(Advertisement): fixed google ads code

* docs(Advertisement): minor grammar correction'

* docs(Advertisement): fix lint issue

* style(Advertisement): update typings, example
@levithomason
Copy link
Member

Released in semantic-ui-react@0.67.1.

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.

None yet

5 participants