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

Button: Wrap text #5636

Closed
wants to merge 4 commits into from
Closed

Conversation

harsh-barach
Copy link

Description

There was an issue(5628) on adding new Button block. When we add more text on button label then text on button was not wrapping.

How Has This Been Tested?

I have tested the issue after fixing it on my local environment.

Screenshots (jpeg or gifs if applicable):

screenshot_1

Types of changes

I have added single line of css in main.scss. By adding this single line of css issue of non wrapping of text is solved now.

Checklist:

  • [Yes] My code is tested.
  • [Yes] My code follows the WordPress code style.
  • [Yes] My code has proper inline documentation.

@maddisondesigns I have solved the issue.

@mcsf mcsf changed the title Merge pull request for solving the issue #5628 Button: Wrap text Mar 15, 2018
@paulwilde
Copy link
Contributor

paulwilde commented Mar 15, 2018

This would be better in the stylesheet for that (particular block rather than the main stylesheet. Also you need a space between .wp-block-button__link and {.

See:
https://github.com/WordPress/gutenberg/blob/b8c91ae3fdfea3c67765ab506b4db4652861755a/blocks/library/button/style.scss

@harsh-barach
Copy link
Author

@paulwilde I have updated the my code by moving the css to respected css of button block.

Copy link
Contributor

@mcsf mcsf left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution! I've left some comments to address. It's important to note that the Block button already has specific rules for wrapping:

https://github.com/harsh-barach/gutenberg/blob/a3776ed793a46204d2df6ebcf72c96c72d053ddf/blocks/library/button/style.scss#L21-L22

@@ -146,4 +146,4 @@ body.gutenberg-editor-page {
font-size: $default-font-size;
padding: 6px 10px;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This file should be reverted to reintroduce the newline at the end.

Copy link
Author

Choose a reason for hiding this comment

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

I have reverted file.

@@ -37,3 +37,9 @@ $blocks-button__line-height: $big-font-size + 6px;
text-align: right;
}
}

.wp-block-button .wp-block-button__link {
Copy link
Contributor

Choose a reason for hiding this comment

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

There already is an appropriate selector within this file, the white-space and word-break rules should be updated there directly. As for their merit, I'll loop in @jasmussen.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @mcsf for suggesting more specific way to add css. I have added my css by your suggested way.

.wp-block-button .wp-block-button__link {
white-space: normal;
word-break: break-all;
height: auto;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is height: auto needed?

Copy link
Author

Choose a reason for hiding this comment

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

I think we can remove it because it does not affects the output.

white-space: normal;
word-break: break-all;
height: auto;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline at end of file.

Copy link
Author

Choose a reason for hiding this comment

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

I have corrected that one.

@mcsf
Copy link
Contributor

mcsf commented Mar 16, 2018

Hey, @harsh-barach, thanks for addressing the feedback. In order to be merge-ready, we're almost there! We need to clean up your Git history a little. For this, we need to:

  • Restore the newline characters at the end of the files.
  • Rebase the commits into something clean.

Here's what you can do:

  • Make sure you're at the right commit and that the diff looks good.
  • Reset your history while preserving your workdir:
git reset `git merge-base origin/master HEAD`
git checkout -p
  • Now, inside checkout, you will reply n to the first hunk, and y to the two remaining ones.
  • Done. Make sure the diff looks good, then commit. The commit message should be something concise like Button: Fix text wrap.
  • Push your changes to GitHub. Since the history was rewritten, you'll have to use git push --force.

(If you make a mistake and want to start over, you can git checkout -f 2f77c8bf4bd58c51e3d25dae6aba3cac1970abf0.)

@harsh-barach
Copy link
Author

I have pushed my changes to Github. But how can i found whether my changes will merge in main directory of Gutenburg?

@mcsf mcsf mentioned this pull request Mar 16, 2018
3 tasks
@mcsf
Copy link
Contributor

mcsf commented Mar 16, 2018

Closed in favor of #5662.

@mcsf mcsf closed this Mar 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants