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

GH-1975 Theme Framework, Leaf & Palm Themes (FINAL) #525

Merged
merged 57 commits into from Apr 15, 2020

Conversation

@benstrumeyer
Copy link
Contributor

@benstrumeyer benstrumeyer commented Apr 14, 2020

  • Have you followed the guidelines in CONTRIBUTING.md?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • Have you added an explanation of what your changes do?
  • Does your submission pass tests?
  • Did you lint your code prior to submission?
  • Can be merged!
  • This PR points to production servers and has all of the necessary extension changes to display the leaf and palm themes that are built off the theme framework which lives inside the account project
  • GH-1967 Themes Panel Update #510 has been merged into this branch, but still needs to be tested
  • GH-1969 Plus In App Promo & GH-1970 Telemetry that displays modals will be a separate PR
benstrumeyer and others added 30 commits Mar 11, 2020
@benstrumeyer benstrumeyer requested review from christophertino and wlycdgr Apr 14, 2020
@benstrumeyer benstrumeyer requested a review from ghostery/ghostery as a code owner Apr 14, 2020
@benstrumeyer benstrumeyer added this to the 8.5.0 milestone Apr 14, 2020
Copy link
Member

@wlycdgr wlycdgr left a comment

A few cleanup & modernization comments on utils#setTheme now that the "real" code has been added back in.

Also, I remember this being discussed in the comments for an earlier version of this PR, but, ....are we sure we want to bundle the theme PNGs with the extension? That's over a megabyte of data that the overwhelming majority of our users will never use (and should not even have access to). And what happens if we add 3 more themes later this year?

app/panel/utils/utils.js Outdated Show resolved Hide resolved
// Other kinds of loops are not supported equally across browsers
let themeStyle = null;
for (let i = 0; i < styleList.length; i++) {
const style = styleList[i];
if (style.title.startsWith(styleTitlePrefix)) {
doc.head.removeChild(style);
themeStyle = style;
}
}
Comment on lines 220 to 227

This comment has been minimized.

@wlycdgr

wlycdgr Apr 14, 2020
Member

We can remove this comment and replace with the tidier forEach, which is now supported in all our supported browser versions

This comment has been minimized.

@benstrumeyer

benstrumeyer Apr 15, 2020
Author Contributor

Good to know, changed to a forEach loop

This comment has been minimized.

@benstrumeyer

benstrumeyer Apr 15, 2020
Author Contributor

I stand corrected, we're unable to use a regular forEach loop because getElementsByTagName returns an HTML collection. I've changed it to Array,prototype.forEach.call(styleList, (style) => {...}) as suggested by the following stackoverflow thread unless you think keeping a basic for loop is cleaner. Thoughts?

https://stackoverflow.com/questions/39797101/why-cant-i-use-array-foreach-on-a-collection-of-javascript-elements

This comment has been minimized.

@wlycdgr

wlycdgr Apr 15, 2020
Member

Ah dang, right, sorry. We can use Array.from(styleList).forEach

for (let i = 0; i < styleList.length; i++) {
const style = styleList[i];
if (style.title.startsWith(styleTitlePrefix)) {
doc.head.removeChild(style);
}
}
Comment on lines 246 to 251

This comment has been minimized.

@wlycdgr

wlycdgr Apr 14, 2020
Member

Here too we can now use forEach

This comment has been minimized.

@benstrumeyer

benstrumeyer Apr 15, 2020
Author Contributor

Changed to a forEach loop

This comment has been minimized.

@benstrumeyer

benstrumeyer Apr 15, 2020
Author Contributor

Same issue as above

@wlycdgr wlycdgr self-requested a review Apr 14, 2020
app/panel/utils/utils.js Outdated Show resolved Hide resolved
@Eden12345
Copy link
Contributor

@Eden12345 Eden12345 commented Apr 14, 2020

@wlycdgr I suggested that we add the background PNG for one of the themes to the extension in a previous PR, but when you put it that way, especially in regards to future theme releases, I agree that it might be better not to.

@benstrumeyer Would it be a huge lift to switch back to the way you had it when you were passing the PNG with the themed Sass file?

@benstrumeyer benstrumeyer requested review from wlycdgr and Eden12345 Apr 15, 2020
Copy link
Member

@wlycdgr wlycdgr left a comment

LGTM

@christophertino christophertino merged commit 99e9de3 into develop Apr 15, 2020
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
@christophertino christophertino deleted the theme-framework branch Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants