-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Themes: Split main into single-site, multi-site,and logged-out #2743
Conversation
881378a
to
c66409e
Compare
c66409e
to
d42fac6
Compare
9d7a572
to
bd43cc1
Compare
<Button primary | ||
onClick={ this.onButtonClick } | ||
>{ this.props.buttonLabel }</Button> | ||
</WebPreview> |
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.
Please indent me.
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.
No component left behind: 7c1ef85
7a724f4
to
c9b34ed
Compare
Looks good! Can't see anything obviously wrong with the code, and tests of LO/SS/MS/analytics seem fine. Going through the code, I noticed that the separation of concerns is a boon to readability. 👍 |
`my-sites/themes/main.jsx` has been overflowing with imports and methods, most of which were used in only one or two out of the single-site, multi-site, and logged-out scenario. Likewise, `theme-options` had to cater for all of those three cases. This commit hence breaks `main` into 3 components corresponding to each of those cases and moves `getButtonOptions()` to each of them, removing conditionals that would only serve the other cases. Because of fewer imports, methods, and branches in each of those files, they should now be more legible. To avoid redundancies, this PR also introduces `<ThemePreview>` for use with each of the three components.
38d8ea3
to
fe1ba46
Compare
Themes: Split main into single-site, multi-site,and logged-out
my-sites/themes/main.jsx
has been overflowing with imports and methods, most of which were used in only one or two out of the single-site, multi-site, and logged-out scenario. Likewise,theme-options
had to cater for all of those three cases.This PR hence breaks
main
into 3 components corresponding to each of those cases and movesgetButtonOptions()
to each of them, removing conditionals that would only serve the other cases. Because of fewer imports, methods, and branches in each of those files, I believe they are now more legible. It's however even more important now to factor out re-usable parts that at least two of those components use. Hence, this PR also introduces<ThemePreview>
.Also,
logged-out.jsx
will hopefully come in handy for SSR.Fixes #2714
PS:
controller.js
could obviously still need a makeover after this PR, but since we might end up with a slightly different routing anyway, I'm postponing that.themes-selection
to bundlethemes-list
and search for SSR. That might be an obsolete level of abstraction with the newlogged-out
component (which also has theme preview) that this PR introduces, so in another iteration, we are probably going to removethemes-selection
.lib/themes/helpers.js
tomy-sites/themes/
(Themes: Move themes/helpers from lib/ to my-sites/ #3055)