-
Notifications
You must be signed in to change notification settings - Fork 84
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
Conversation
* Text internal to button is positioned one pixel higher due to allowing flex to centre, rather than using a one pixel offset
e20f135
to
a019c34
Compare
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.
Minor doc comments. Out of interest are these output in the demo site?
src/components/button/button.js
Outdated
@@ -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 |
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.
smaller
src/components/button/button.js
Outdated
|
||
/** | ||
* 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 |
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.
Allows subtext to be set.
Currently only allowing when button is large.
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.
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.
src/components/button/button.js
Outdated
* 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 |
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.
property name doesn't match
src/components/button/button.js
Outdated
* 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 |
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.
This documentation doesn't apply to subtext
src/components/button/button.js
Outdated
* Currently only setting a smalleer font in a large button is allowed, which we do with CSS | ||
* | ||
* @property fontSize | ||
* @type {String} |
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.
Should this be Boolean?
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 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) |
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.
Move these two lines to v1.3.0 in CHANGELOG.md
046eeb9
to
4b450b6
Compare
src/components/button/button.js
Outdated
size: PropTypes.string, | ||
|
||
/** | ||
* Sets a second bit of text under the main text, feinter and smaller. |
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.
[minor] fainter
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.
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.
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.
Really, I always thought feint
meant something like a fake attack.
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.
https://www.collinsdictionary.com/dictionary/english/feint-ruled-paper
I'll change this though I think this is less internationally understandable
38edfd1
to
3e8e091
Compare
3e8e091
to
eee624b
Compare
* Alphabetise private `Button` functions. * Correct comments. * Check for Boolean type explicitly in `smallFont` proptype function * Ensure nice deafult for `smallFont`
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.
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.
They're actually two separate things, |
I didn't entirely understand the issues. When you say split text do you mean |
@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. |
* 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
… into 1385-and-1386-button-updates
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.
The CSS change will need to be referenced in the release notes.
src/components/button/button.scss
Outdated
@@ -35,9 +38,20 @@ | |||
} | |||
|
|||
&.carbon-button--large { | |||
font-size: 16px; | |||
font-size: $app-font-size; |
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.
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
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.
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; |
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.
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.
@abramin Thanks for the cross browser checking!
Could I have some more details on context and steps to reproduce both of the above?
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.
The screenshots are from the demo the site in Safari. To see the hamburger menu you need to shrink the browser a bit.
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.
Right thanks for that, I'll get a look
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.
Looks fine in Chrome & Firefox.
Menu button broken in Edge but regular button looks fine.
Don't have IE11 to test locally.
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've updated the PR description so this can be more easily tracked
* 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
Description
d8ea3eb
e90261b
a019c34
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
Related Issues / Pull Requests
#1385
#1386
Screenshots / Gifs
Left is the design, right is the demo site:

Testing Instructions
subtext
prop will add the text as expected, but only if the button size is largeBrowsers
QA Issues
smallFont
prop being sent through to Link erroneously