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

Mailchimp Block: UI Review Updates #30685

Merged
merged 19 commits into from
Feb 11, 2019
Merged

Conversation

jeffersonrabb
Copy link
Contributor

@jeffersonrabb jeffersonrabb commented Feb 9, 2019

Changes proposed in this Pull Request

This PR contains a series of UI and design improvements flagged by @thomasguillot and @scruffian in #30667. Since the block uses Server-Side Rendering, many of these fixes involve similar changes in the Jetpack repo. Here's the list of changes. Quoted text is from the issue.

Editor UI:

I don't see the need for us to have a heading as part of the block. If for some reason we need one, we should have the same options as the Heading block.

Done in 141d9f2 and Automattic/jetpack@9431ca9

Can the email input be a type="email" rather than type="text"

Done in e363a8c and Automattic/jetpack@d921ac3

Could we have a button like the Button block and remove the label option from the sidebar?

Done in da91702.

Notes/Questions:

  • I applied a class from the core Button block ( wp-block-button__link ) to get some of the style without duplicating a bunch of CSS. This might be a questionable practice since future changes Core Button could affect Mailchimp in unexpected ways. Curious if there are opinions on the best way to handle this situation.
  • Core Button's background color defaults to #0073aa, which is not one of the Muriel blues. It seemed preferable to replicate the Core style rather than stick to Muriel colors and create dissonance, but I'm happy to go either way on this.
  • On the Frontend, the button has only these classes components-button is-button is-primary, which should leave the button style to the theme.

The text underneath, could it just be a Paragraph block (within the block) with some italic applied to it? At the moment, the italic setting doesn't work since it's already in italic. I'm not quite sure why this is a figcaption either, from an HTML point of view this makes no sense and it's invalid.

Done in 7f61c70 and Automattic/jetpack@f801919. I applied a few additional styles here:

.wp-block-jetpack-mailchimp_consent-text {
color: $gray;
font-size: 0.8em;
font-style: italic;

Some places it's written "MailChimp", and some other "Mailchimp". The correct version is "Mailchimp" now.

Done in caaf827 and Automattic/jetpack@1a0be76.

Note: In the WP.com sharing interface, there are still instances of MailChimp that should be changed. @artpi would you be willing to take care of these when you have a chance?

Front-end:

The forced styles on the email input are not needed .wp-block-jetpack-mailchimp .wp-block-jetpack-mailchimp-email themes style their inputs and forcing this is not recommended.

Done in 49e51ba and Automattic/jetpack@5dba739

Same with .wp-block-jetpack-mailchimp .wp-block-jetpack-mailchimp-form-error I would suggest we add a generic class error to the input. Again, most themes will style this.

Done in 4653bca.

Note: This is tough to test now that the input field is type email, since the browser automatically enforces validation. Also, in the Inspector I tried adding the generic error class to the input, and didn't see any visual change.

Displaying all 3 messages in the content with a display: none feels strange. Can we just add the message with some JS?

For the Editor, this is done in c8d0bf7.

Note: For the Frontend, it isn't terribly straightforward. The approach would probably be to store the notification text bits as data attributes on the block element, and then rework view.js to put the appropriate text in the DIV. I'd be happy to do this, but it feels like swapping one form of awkwardness for another, so I'm not sure there's much of a win here. If people feel that this should be done, I'll take it on in a separate PR.

For all the color-related changes, it wasn't entirely clear to me where the discussion in the issue landed. Muriel? Gutenberg? For now, I just used @thomasguillot's original colors as-is. If the consensus was to go a different way, let me know and I'll change.

Processing, have a more subtle background: rgba(0, 0, 0, 0.025)

Done in d1e4518

Success: Let's use an accessible green #1d7819

Done in d1e4518

Same for error: #eb0001

Done in d1e4518

.wp-block-jetpack-mailchimp .wp-block-jetpack-mailchimp-notification let's switch to ems: margin-bottom: 1.5em and padding: 0.75em.

Done in 38e9cd2

Remove the text-center from the messages. If the user adds a bunch of text to these messages, it wouldn't look great centred.

Done in ce80348

Testing instructions

Fixes #30667

@matticbot
Copy link
Contributor

@jeffersonrabb jeffersonrabb added Mailchimp [Goal] Gutenberg Working towards full integration with Gutenberg [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Feb 9, 2019
@jeffersonrabb jeffersonrabb self-assigned this Feb 9, 2019
@thomasguillot
Copy link
Contributor

It looks great, thank you @jeffersonrabb! I just have a couple of notes/remarks:

Core Button's background color defaults to #0073aa, which is not one of the Muriel blues.

Core Button's background color is good 👍 I'm just wondering now if we should allow for background/text custom colors like the actual Button block: https://cloudup.com/coHwOau93wT

Also, we shouldn't have a "link" option for the button and italic/bold doesn't seem to work, I think it's safe to remove these: https://cloudup.com/czHUFkuNB1N

I applied a few additional styles here

Rather than forcing the color, font-size and font-style, can we just have a <small> text and then leave the rest to the user/theme to decide?

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

A quick comment, I'll have another look when design feedback is addressed.

<TextControl placeholder={ emailPlaceholder } onChange={ () => false } />
<Button isPrimary>{ submitLabel }</Button>
<TextControl placeholder={ emailPlaceholder } onChange={ () => false } type="email" />
<div className="wp-block-button__link wp-block-jetpack-mailchimp_button">
Copy link
Member

Choose a reason for hiding this comment

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

Was it impossible to use the Button component here? I'd very much prefer to rely on that component rather than a class it uses.

If we need the styling, I think we're better off pulling the necessary styles into our own CSS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal was to emulate the Gutenberg button block in appearance and functionality - and since https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/button/edit.js doesn't make use of the Button component I fear that this would lead to slight style divergences and then CSS to overcome them. Re: the styling, yes I'll pull it in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we need the styling, I think we're better off pulling the necessary styles into our own CSS.

This is done in 8f066fd

@jeffersonrabb
Copy link
Contributor Author

Also, we shouldn't have a "link" option for the button and italic/bold doesn't seem to work, I think it's safe to remove these: https://cloudup.com/czHUFkuNB1N

Removed all the formatting controls in bc6db32

@jeffersonrabb
Copy link
Contributor Author

Rather than forcing the color, font-size and font-style, can we just have a <small> text and then leave the rest to the user/theme to decide?

Confirming, the suggestion is to replace the <p> tag with <small>? (as opposed to adding <small> as a wrapper around it?)

…onsistency with Core Button block without relying on a class from that block (wp-block-button__link).
@jeffersonrabb
Copy link
Contributor Author

I'm just wondering now if we should allow for background/text custom colors like the actual Button block: https://cloudup.com/coHwOau93wT

I like the idea, but fear this puts us on a slippery slope of chasing the core button block. If we allow color customization would we also need to support core Button's style choices (Rounded|Outline|Squared)? Button has what looks like fairly dense color fallback handling, and uses a component called ContrastChecker that seems a little ... daunting. If changes were made to the Button block down the road presumably we'd want to replicate them in Mailchimp. Finally, the front-end rendering of the button in Mailchimp is quite a bit simpler than it is for Button block, using a <button> element with a couple of classes on it effectively leaving the button styling to the theme. If we introduce visual customization elements for the button colors this would need to be examined.

Given all of this, if you still feel we ought to pursue color options for the button I'd propose we land the current PR and address in a new one. @thomasguillot what do you think?

@thomasguillot
Copy link
Contributor

Rather than forcing the color, font-size and font-style, can we just have a <small> text and then leave the rest to the user/theme to decide?

Confirming, the suggestion is to replace the <p> tag with <small>? (as opposed to adding <small> as a wrapper around it?)

<p><small>........</small></p>

@thomasguillot
Copy link
Contributor

Given all of this, if you still feel we ought to pursue color options for the button I'd propose we land the current PR and address in a new one. @thomasguillot what do you think?

Fair enough, thank you for the explanation @jeffersonrabb. Let's keep it as is 😊

@jeffersonrabb
Copy link
Contributor Author

<p><small>........</small></p>

I'm not sure this structure is possible - we're using the RichText component which allows setting the containing element as an attribute (

). However, there isn't support that I'm aware of for structured tag hierarchy within the element. If I simply change the tagName attribute to small, the output looks pretty good but there's no paragraph tag. Is this invalid HTML? Also note this applies only to the editor. In the front-end we can structure the output however we'd like.

@sirreal
Copy link
Member

sirreal commented Feb 11, 2019

I'm not sure this structure is possible

Can't you do the following?

<p><RichText tagName="small" /><p>

@jeffersonrabb
Copy link
Contributor Author

Can't you do the following? <p><RichText tagName="small" /><p>

RichText inserts a bunch of container <div>s, so if we take this approach we end up with markup like this:

screen shot 2019-02-11 at 7 50 59 am

@thomasguillot is this acceptable markup?

@thomasguillot
Copy link
Contributor

@thomasguillot is this acceptable markup?

It's not 😞p can't contain div. It's ok. For the editor we can just go with small and have p smallfor the front-end.

@sirreal
Copy link
Member

sirreal commented Feb 11, 2019

RichText inserts a bunch of container <div>s

😞 I actually came across similar problem when I tried to use it recently. I wonder if it could be improved to help with cases like this. There do seem to be short-term plans to iterate on the component: WordPress/gutenberg#13778

@jeffersonrabb
Copy link
Contributor Author

It's not 😞p can't contain div. It's ok. For the editor we can just go with small and have p smallfor the front-end.

So much 😞around this one! Changes made in d59edb6 and Automattic/jetpack@f4a7d65. I left the color and italics declarations in but removed the sizing - is this correct?

@thomasguillot
Copy link
Contributor

It's not 😞p can't contain div. It's ok. For the editor we can just go with small and have p smallfor the front-end.

So much 😞around this one! Changes made in d59edb6 and Automattic/jetpack@f4a7d65. I left the color and italics declarations in but removed the sizing - is this correct?

Can we just remove the entire CSS for .wp-block-jetpack-mailchimp_consent-text?

small is enough to differentiate the text from the rest of the content.

@jeffersonrabb
Copy link
Contributor Author

Can we just remove the entire CSS for .wp-block-jetpack-mailchimp_consent-text?

Done in 1bc9f82 and Automattic/jetpack@6961def#diff-e800fe1ba24cea2c2da6f6ac9f542d4dR68

@thomasguillot
Copy link
Contributor

screenshot 2019-02-11 at 14 56 21

Front-end doesn't seem to work anymore

@jeffersonrabb
Copy link
Contributor Author

Front-end doesn't seem to work anymore

Try pulling the Jetpack branch (if you're testing locally), or create a new JN instance. Just resolved the issue in Automattic/jetpack@89d53f0.

Copy link
Contributor

@thomasguillot thomasguillot left a comment

Choose a reason for hiding this comment

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

LGTM

…line toolbar, to allow selection of the submit button after consent text editing has taken place. Use appropriate cursor for button text hover and editing.
@jeffersonrabb
Copy link
Contributor Author

@artpi pointed out an issue in which the consent text's inline toolbar blocks clicks on the submit button, making the button non-editable. This is fixed along with a change to the button text's cursor in 4518d4e.

@thomasguillot does this approach raise any red flags?

@thomasguillot
Copy link
Contributor

@thomasguillot does this approach raise any red flags?

Nope, all good 🙂

@jeffersonrabb jeffersonrabb merged commit 4e9adc3 into master Feb 11, 2019
@jeffersonrabb jeffersonrabb deleted the update/mailchimp-ui-changes branch February 11, 2019 18:02
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] Gutenberg Working towards full integration with Gutenberg Mailchimp
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mailchimp: Visual review
5 participants