-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Add support for <amp-facebook-page> #13261
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
Conversation
597bc52 to
ed4d827
Compare
cvializ
left a comment
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.
Hey thanks! Just a few comments and questions.
Also could you please update your PR description to include the issue number for the bug that this resolve, along with any extra description? Consider writing details like your general approach, what you based your code on, or any areas to pay closer attention to. That can help reviewers do a better job and provide context.
| this.iframe_ = null; | ||
|
|
||
| /** @private {string} */ | ||
| this.dataLocale_ = element.getAttribute('data-locale'); |
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.
You should assign this.dataLocale_ as the result of a ternary or || expression instead of an if, so that you can annotate this.dataLocale_ as @const for more type safety
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've made the change here. However, I have written the same code in other files: amp-facebook{,-like,-comments}.js.
Do you mind if I make the change in a separate PR? Or would you like that done here. Happy either way.
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.
Ah cool, a separate PR would be ok
| limitations under the License. | ||
| --> | ||
|
|
||
| # <a name="amp-facebook-like"></a> `amp-facebook-like` |
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.
Replace this with amp-facebook-page
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.
Done
| @@ -0,0 +1,93 @@ | |||
| <!--- | |||
| Copyright 2017 The AMP HTML Authors. All Rights Reserved. | |||
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.
nit: 2018
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.
Done across all files
| layout="fixed" | ||
| data-hide-cover="true" | ||
| data-href="https://www.facebook.com/testesmegadivertidos/"> | ||
| </amp-facebook-like> |
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.
amp-facebook-page
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.
Done
| } | ||
| tags: { # <amp-facebook-page> | ||
| html_format: AMP | ||
| tag_name: "AMP-FACEBOOK-page" |
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.
nit: should be all-caps AMP-FACEBOOK-PAGE
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.
Done
|
|
||
| Attribute hides cover photo in the header. `false` (cover photo displayed) by default. | ||
|
|
||
| ##### data-face-pile (optional) |
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.
Should this be data-show-face-pile to match 3p/facebook.js?
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.
Yes. Done
3p/facebook.js
Outdated
| container.setAttribute('data-numposts', data.numposts || 10); | ||
| container.setAttribute('data-colorscheme', data.colorscheme || 'light'); | ||
| container.setAttribute('data-width', '100%'); | ||
| container.setAttribute('data-height', '100%'); |
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.
Is this line change intentional? It looks like it affects amp-facebook-comments where this PR is for the amp-facebook-page
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.
Nope. That was unintentional. Didn't clean it up.
honeybadgerdontcare
left a comment
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.
replace 2017 with 2018 throughout files.
nainar
left a comment
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.
Hi @cvializ I have made the changes you asked to the files and to the PR description.
PTAL?
Thanks for reviewing!
3p/facebook.js
Outdated
| container.setAttribute('data-numposts', data.numposts || 10); | ||
| container.setAttribute('data-colorscheme', data.colorscheme || 'light'); | ||
| container.setAttribute('data-width', '100%'); | ||
| container.setAttribute('data-height', '100%'); |
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.
Nope. That was unintentional. Didn't clean it up.
| @@ -0,0 +1,93 @@ | |||
| <!--- | |||
| Copyright 2017 The AMP HTML Authors. All Rights Reserved. | |||
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.
Done across all files
| limitations under the License. | ||
| --> | ||
|
|
||
| # <a name="amp-facebook-like"></a> `amp-facebook-like` |
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.
Done
| layout="fixed" | ||
| data-hide-cover="true" | ||
| data-href="https://www.facebook.com/testesmegadivertidos/"> | ||
| </amp-facebook-like> |
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.
Done
|
|
||
| Attribute hides cover photo in the header. `false` (cover photo displayed) by default. | ||
|
|
||
| ##### data-face-pile (optional) |
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.
Yes. Done
| } | ||
| tags: { # <amp-facebook-page> | ||
| html_format: AMP | ||
| tag_name: "AMP-FACEBOOK-page" |
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.
Done
| this.iframe_ = null; | ||
|
|
||
| /** @private {string} */ | ||
| this.dataLocale_ = element.getAttribute('data-locale'); |
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've made the change here. However, I have written the same code in other files: amp-facebook{,-like,-comments}.js.
Do you mind if I make the change in a separate PR? Or would you like that done here. Happy either way.
cvializ
left a comment
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.
Awesome! I'm happy with the code, but it looks like you'll need to make some small changes to get the gulp lint to pass.
| this.iframe_ = null; | ||
|
|
||
| /** @private {string} */ | ||
| this.dataLocale_ = element.getAttribute('data-locale'); |
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.
Ah cool, a separate PR would be ok
| */ | ||
|
|
||
|
|
||
| import {getIframe, preloadBootstrap} from '../../../src/3p-frame'; |
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.
Looks like there's a linter error in Travis: https://travis-ci.org/ampproject/amphtml/jobs/337825128 You'll need to sort your import lines.
c66a1c8 to
32d2e9d
Compare
|
Hi @cvializ - thanks so much for the review! I have cleaned up the lint and validator issue. Please merge the request? |
* Revision bump for #13261 - Add support for `<amp-facebook-page>` * Add media query parsing class to CSS parser. This isn't wired up to the validator currently, but will be in a later CL. * Use the recommended closure dependency management for JavaScript libraries. * Add AMP4EMAIL rules. * Remove stray console.log statments. * Small tweaks to #13406 * Revision bump for #13381
* Remove spurious files * cvializ@ suggested changes * Fixed Travis CI failures
* Revision bump for ampproject#13261 - Add support for `<amp-facebook-page>` * Add media query parsing class to CSS parser. This isn't wired up to the validator currently, but will be in a later CL. * Use the recommended closure dependency management for JavaScript libraries. * Add AMP4EMAIL rules. * Remove stray console.log statments. * Small tweaks to ampproject#13406 * Revision bump for ampproject#13381
* Remove spurious files * cvializ@ suggested changes * Fixed Travis CI failures
* Revision bump for ampproject#13261 - Add support for `<amp-facebook-page>` * Add media query parsing class to CSS parser. This isn't wired up to the validator currently, but will be in a later CL. * Use the recommended closure dependency management for JavaScript libraries. * Add AMP4EMAIL rules. * Remove stray console.log statments. * Small tweaks to ampproject#13406 * Revision bump for ampproject#13381
* Remove spurious files * cvializ@ suggested changes * Fixed Travis CI failures
* Revision bump for ampproject#13261 - Add support for `<amp-facebook-page>` * Add media query parsing class to CSS parser. This isn't wired up to the validator currently, but will be in a later CL. * Use the recommended closure dependency management for JavaScript libraries. * Add AMP4EMAIL rules. * Remove stray console.log statments. * Small tweaks to ampproject#13406 * Revision bump for ampproject#13381
Fixes #10919
Most of the template is copied from similar elements like <amp-facebpook-{like,comment}>
Note: Currently the file test-amp-facebook doesn't have tests for <amp-facebpook-{like,comment}> so I didn't add any for the new , let me know if I should change that.