Skip to content

Conversation

@CGastrell
Copy link
Contributor

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.

@CGastrell CGastrell added enhancement New feature or request Janitorial labels Apr 26, 2023
@CGastrell CGastrell requested a review from ice9js April 26, 2023 19:19
@CGastrell CGastrell self-assigned this Apr 26, 2023
Copy link

@sgomes sgomes left a 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! 🙏

Comment on lines 127 to 132
// input,
// textarea {
// box-sizing: border-box;
// font-size: var(--crowdsignal-forms-text-size) !important;
// padding: 16px !important;
// }
Copy link

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up, thanks!

Comment on lines 508 to 523
<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>
Copy link

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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!

onClick={ onClose }
>
<Icon icon="no-alt" />
X
Copy link

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 ) =>
Copy link

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 😕

Base automatically changed from update/dependencies-node-0-18 to master April 28, 2023 15:07
@CGastrell CGastrell force-pushed the remove/wp-components-dependency branch from 7936f3a to 29833b0 Compare April 28, 2023 15:21
@CGastrell CGastrell merged commit 0ec113d into master May 3, 2023
@CGastrell CGastrell deleted the remove/wp-components-dependency branch May 3, 2023 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants