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

1385 and 1386 button updates #1391

Merged
merged 17 commits into from
Jul 25, 2017
Merged

1385 and 1386 button updates #1391

merged 17 commits into from
Jul 25, 2017

Conversation

toni-sharpe
Copy link

@toni-sharpe toni-sharpe commented Jul 4, 2017

Description

d8ea3eb

e90261b

  • Allows smaller font to be set in large Buttons

a019c34

  • Allows two-tier button with subtext

Note: the one pixel difference in internal alignment is because I let flex do it's thing centring rather than adding an extra pixel of pushing around, which I didn't think was a good idea.

TODO

  • Release notes

Related Issues / Pull Requests

#1385
#1386

Screenshots / Gifs

Left is the design, right is the demo site:
image

Testing Instructions

  • Use the demo site: check the subtext prop will add the text as expected, but only if the button size is large

Browsers

  • IE11
  • Edge
  • Safari
  • Chrome
  • Firefox

QA Issues

  • flex problems in Edge
  • flex problems in Safari
  • smallFont prop being sent through to Link erroneously

Toni-Leigh Sharpe added 3 commits July 4, 2017 16:11
* In preparation for #1385 and #1386 where the text size will become more flexible
* Text internal to button is positioned one pixel higher due to allowing flex to centre, rather than using a one pixel offset
@toni-sharpe toni-sharpe force-pushed the 1385-and-1386-button-updates branch from e20f135 to a019c34 Compare July 4, 2017 15:14
@andrewjtait andrewjtait modified the milestones: v1.3.0, v1.2.0 Jul 4, 2017
Copy link
Contributor

@adamgeorgeson adamgeorgeson left a comment

Choose a reason for hiding this comment

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

Minor doc comments. Out of interest are these output in the demo site?

@@ -58,6 +58,21 @@ class Button extends React.Component {
disabled: PropTypes.bool,

/**
* Allows a font size to be set that alters the default font size.
* Currently only setting a smalleer font in a large button is allowed, which we do with CSS
Copy link
Contributor

Choose a reason for hiding this comment

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

smaller


/**
* Allows a font size to be set that alters the default font size.
* Currently only setting a smalleer font in a large button is allowed, which we do with CSS
Copy link
Contributor

Choose a reason for hiding this comment

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

Allows subtext to be set.
Currently only allowing when button is large.

Copy link
Contributor

@abramin abramin left a comment

Choose a reason for hiding this comment

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

The propType functions aren't currently checking for type - i.e. They will allow any values to be entered.
e.g. The smallText prop seems to a Boolean but will not throw an error if a string is passed.

* Allows a font size to be set that alters the default font size.
* Currently only setting a smalleer font in a large button is allowed, which we do with CSS
*
* @property fontSize
Copy link
Contributor

Choose a reason for hiding this comment

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

property name doesn't match

* Allows a font size to be set that alters the default font size.
* Currently only setting a smalleer font in a large button is allowed, which we do with CSS
*
* @property fontSize
Copy link
Contributor

Choose a reason for hiding this comment

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

This documentation doesn't apply to subtext

* Currently only setting a smalleer font in a large button is allowed, which we do with CSS
*
* @property fontSize
* @type {String}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be Boolean?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering this too. The return values made me question myself.

CHANGELOG.md Outdated
@@ -171,6 +171,8 @@ return (

* `Alert` now alerts itself to screen readers.
* `Browser`: add a new method `setInputFocus` to focus on the input field of passed in ref but does not select text
* `Button`: Allows small text on a large button [#1386](https://github.com/Sage/carbon/issues/1386)
Copy link
Author

Choose a reason for hiding this comment

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

Move these two lines to v1.3.0 in CHANGELOG.md

@toni-sharpe toni-sharpe force-pushed the 1385-and-1386-button-updates branch from 046eeb9 to 4b450b6 Compare July 5, 2017 08:20
size: PropTypes.string,

/**
* Sets a second bit of text under the main text, feinter and smaller.
Copy link
Contributor

Choose a reason for hiding this comment

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

[minor] fainter

Copy link
Author

Choose a reason for hiding this comment

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

They use feint to describe extremely lightly lined paper and I extrapolated from that, however, I might actually be wrong to use the word like this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Really, I always thought feint meant something like a fake attack.

Copy link
Author

Choose a reason for hiding this comment

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

https://www.collinsdictionary.com/dictionary/english/feint-ruled-paper

I'll change this though I think this is less internationally understandable

@toni-sharpe toni-sharpe force-pushed the 1385-and-1386-button-updates branch from 38edfd1 to 3e8e091 Compare July 5, 2017 08:49
Toni-Leigh Sharpe added 3 commits July 5, 2017 09:55
* Alphabetise private `Button` functions.
* Correct comments.
* Check for Boolean type explicitly in `smallFont` proptype function
* Ensure nice deafult for `smallFont`
Copy link
Contributor

@abramin abramin left a comment

Choose a reason for hiding this comment

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

Thinking more about this, I'm not sure what need there is for the smallFont prop. It seems only relevant when you have a large button and subtext present.

@toni-sharpe
Copy link
Author

toni-sharpe commented Jul 10, 2017

@abramin the smallFont prop is required because when the button is used alongside one with split text two tier text - the issue has more detail

@toni-sharpe
Copy link
Author

They're actually two separate things, smallFont is not used to govern the font-size of the two tier button

@abramin
Copy link
Contributor

abramin commented Jul 10, 2017

I didn't entirely understand the issues. When you say split text do you mean subText?
I see now that the smallFont prop is separate but I'm still not clear about its purpose.
Do we always want to keep font size the same between large and medium buttons perhaps? Maybe worth checking with UX.

@toni-sharpe
Copy link
Author

@abramin It's separate because I want to be able to control the font-size of one button so that the font can be set to a size which is visually coherent when that button is used with a second button that has two tier text. This prop defaults to false, so the button text will stay large unless purposely chosen.

It's feasible someone could use this prop on it's own, which I didn't think was a terrible thing to offer the developer, it might come out in other designs too, these things often do.

Toni Leigh Sharpe added 5 commits July 10, 2017 09:27
* The small font change relating to issue #1386 was reverted as it was decided to add this font size to all large buttons
* This commit also includes the font-size change
Copy link
Contributor

@abramin abramin left a comment

Choose a reason for hiding this comment

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

The CSS change will need to be referenced in the release notes.

@@ -35,9 +38,20 @@
}

&.carbon-button--large {
font-size: 16px;
font-size: $app-font-size;
Copy link
Contributor

Choose a reason for hiding this comment

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

could we just not remove this line? As it's set in the parent class,

* Font size setting was not needed on large button
* Release note for font size
Copy link
Contributor

@abramin abramin left a comment

Choose a reason for hiding this comment

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

The smallFont prop is still in defaultProps.

border: $carbon-button__border--secondary;
border-radius: $carbon-button__border-radius;
box-sizing: border-box;
cursor: pointer;
display: inline-block;
display: inline-flex;
Copy link
Contributor

Choose a reason for hiding this comment

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

These CSS changes seem to have broken the button contents in Safari.
screen shot 2017-07-12 at 09 09 24
screen shot 2017-07-12 at 09 09 27

Copy link
Author

Choose a reason for hiding this comment

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

@abramin Thanks for the cross browser checking!

Could I have some more details on context and steps to reproduce both of the above?

Copy link
Contributor

Choose a reason for hiding this comment

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

The screenshots are from the demo the site in Safari. To see the hamburger menu you need to shrink the browser a bit.

Copy link
Author

Choose a reason for hiding this comment

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

Right thanks for that, I'll get a look

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks fine in Chrome & Firefox.

Menu button broken in Edge but regular button looks fine.

Don't have IE11 to test locally.

Copy link
Author

Choose a reason for hiding this comment

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

I've updated the PR description so this can be more easily tracked

Toni Leigh Sharpe added 3 commits July 24, 2017 09:24
* We need to use an internal wrapper when there are multiple children in the button
* This is because flex will not apply to certain HTML elements in certain browsers
* [link for more](https://stackoverflow.com/questions/35464067/flexbox-not-working-on-button-element-in-safari)

* Set the same flex definitions on the internal wrapper so if it exists it applies to those children
* `column` is also applied as our children are stacked for this quite tightly controlled contents

* Also fix demo site menu spacing
@andrewjtait andrewjtait dismissed abramin’s stale review July 25, 2017 09:47

I have QA'd the recent changes 👍

@andrewjtait andrewjtait merged commit 36cf5a2 into master Jul 25, 2017
@andrewjtait andrewjtait deleted the 1385-and-1386-button-updates branch July 25, 2017 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

5 participants