-
Notifications
You must be signed in to change notification settings - Fork 9
Optimize frontend components #263
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
sgomes
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.
LGTM! 👍
I left a few comments, and I think this is probably best reviewed by someone that has a deeper understanding of the codebase as well, but the approach and the code look good.
Thank you again for working on this, @CGastrell! 🙏
| // input, | ||
| // textarea { | ||
| // box-sizing: border-box; | ||
| // font-size: var(--crowdsignal-forms-text-size) !important; | ||
| // padding: 16px !important; | ||
| // } |
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 may have missed this when creating the PR. Probably something you intended to delete?
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.
Cleaned up, thanks!
client/blocks/feedback/edit.js
Outdated
| <Tooltip | ||
| text={ promoteLink } | ||
| position="top center" | ||
| > | ||
| <a | ||
| href="https://crowdsignal.com/pricing" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="crowdsignal-forms__branding-promote" | ||
| > | ||
| { __( | ||
| 'Hide', | ||
| 'crowdsignal-forms' | ||
| ) } | ||
| </a> | ||
| </Tooltip> |
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 may have considered this already, but one possibility would be to extract this to a separate module, to be used for both feedback/edit.js and nps/edit.js. That would still keep it out of the frontend, and should be handled just fine by the build process.
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.
Yeah, I think I was mostly dashing and slashing until I got it out, likely suspect to get into a module on its own.
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 moved the tooltip to a separate component so to reuse it. Thanks for the suggestion!
client/components/nps/index.js
Outdated
| onClick={ onClose } | ||
| > | ||
| <Icon icon="no-alt" /> | ||
| X |
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.
Suggest using ✖ or ✕ instead, which are a bit more visually distinct from the letter X.
Alternatively, you could embed a tiny SVG here; in general it's a bad practice to do SVG-in-JS, but if it's something tiny that you're using in a single spot, that's fine.
| import { Component } from '@wordpress/element'; | ||
| import { createHigherOrderComponent } from '@wordpress/compose'; | ||
|
|
||
| export const withWordPressFallbackStyles = ( mapNodeToProps ) => |
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.
Good call on moving this method here! 👍
Given the way that Gutenberg recommends externs for WP and how big @wordpress/components is, it's really not a great idea to have utility methods in there 😕
…the frontend components
7936f3a to
29833b0
Compare
This PR attempts to remove, as far as possible, dependencies on @wordpress/components on the frontend components to lower the size of the builds and improve render performance.