-
Notifications
You must be signed in to change notification settings - Fork 4k
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
feat(Advertisement): add new component #1292
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
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? |
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.
@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' | |||
|
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.
Unnecessary blank line.
} from '../../lib' | ||
|
||
/** | ||
*An ad displays third-party promotional content |
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.
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' |
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.
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} /> |
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.
I think that this component will have children
?
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.
Also, to get test working you need use there getUnhandledProps
function and spread rest
to ElementType
.
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.
And you need to add _meta
of course.
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.
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.
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.
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 pushed a new commit with your changes. Here's a screenshot of the test that fails. Im defining the |
I've pushed some commits, tests are passed 👍 |
@layershifter checked them out right now. Don't we also need a nil check for |
@layershifter could we create like a to-do for this task? That would help knocking things off. Let me know your thoughts. |
Nope.
Let's implement examples from SUI docs. |
@layershifter hmm alright. So are we handling the various sizes via |
Let me know if you think these are on point and what you're looking for! |
@tarang9211 I'll take a look today. |
Okay, as I see we have following units:
Other props:
ThoughtsAll 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? |
Thanks for the input I'll get to this in a few |
@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'
]) |
@jcarbo good suggestion, I like it 👍 |
Pushing a commit with @jcarbo's suggestions! Could someone explain what |
@levithomason let me know what you think of the changes I made. |
Any idea about my concern regarding the sizing issue?
…On Tue, Feb 14, 2017 at 9:53 PM Levi Thomason ***@***.***> wrote:
***@***.**** approved this pull request.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1292 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFmqGUTK2S__pAM9aVtY1Okdp0B_wwgHks5rcdUHgaJpZM4L4cJu>
.
|
Checking into it, I think it is 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) |
Same for me. I noticed the same thing
…On Tue, Feb 14, 2017 at 9:58 PM Levi Thomason ***@***.***> wrote:
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)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1292 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFmqGRdIVWF7I9Z6ahB5VL9EEo3G6XKMks5rcdYbgaJpZM4L4cJu>
.
|
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: I am not sure on the mounting problem. |
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. |
Interesting. Sounds good, let me know your findings. Let's try to get this merged soon! |
@layershifter Could you help look into this? We're pretty close to a merge |
@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. |
OK, let's give it a try. Whatever solves the problem is the correct answer :) |
@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. |
…React into feat/new-component-advertisement
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.
@levithomason I've updated typings structure and reverted standart example. LGTM, I think we ready to go 🚤
@layershifter Thanks for getting to this! Appreciate the help |
Nice work fellas! 🎉 |
* (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
* (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
Released in |
Fixes #185