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

fix: change high precision money display #661

Merged
merged 16 commits into from
Apr 11, 2019
Merged

Conversation

montezume
Copy link
Contributor

@montezume montezume commented Apr 9, 2019

Summary

Currently, when a price is highPrecision, the MoneyField "jumps", as it is rendering a label above the field. This is not desired. Instead, we replace it with the use of an icon, and an accompanying tooltip in the MoneyInput.

Before

beforemf

After

aftermf

Also adds new FractionDigitsIcon

@@ -111,3 +111,4 @@ In the following example, the tooltip text only appears on hover when the button
| `horizontalConstraint` | `object` | - | `xs`, `s`, `m`, `l`, `xl`, `scale` | `scale` | Horizontal size limit of the tooltip |
| `children` | `node` | ✅ | - | - | Content rendered within the tooltip |
| `components` | `object` | - | `WrapperComponent`, `BodyComponent` | - | If passed, the tooltip will wrap your component with this element |
| `customBodyStyles` | `object` | - | - | - | If passed, these styles will be spread onto the div surrounding the tooltip body |
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if I am overly picky with the name again. But given we tend to like the components={{header, footer}} pattern. How about going with styles={ body } here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure can do

@@ -111,4 +111,4 @@ In the following example, the tooltip text only appears on hover when the button
| `horizontalConstraint` | `object` | - | `xs`, `s`, `m`, `l`, `xl`, `scale` | `scale` | Horizontal size limit of the tooltip |
| `children` | `node` | ✅ | - | - | Content rendered within the tooltip |
| `components` | `object` | - | `WrapperComponent`, `BodyComponent` | - | If passed, the tooltip will wrap your component with this element |
| `customBodyStyles` | `object` | - | - | - | If passed, these styles will be spread onto the div surrounding the tooltip body |
| `styles` | `object` | - | - | - | If passed, these styles will be spread onto the div surrounding the tooltip body |
Copy link
Contributor

Choose a reason for hiding this comment

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

styles.body

@montezume montezume added the 💅 Type: Enhancement Improves existing code label Apr 10, 2019
@montezume montezume self-assigned this Apr 10, 2019
@montezume montezume requested a review from islam3zzat April 10, 2019 08:59
getAmountInputStyles({ ...this.props, hasFocus }),
// accounts for size of icon
css`
padding-right: 24px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
padding-right: 24px;
padding-right: ${vars.spacing24};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@@ -111,3 +111,4 @@ In the following example, the tooltip text only appears on hover when the button
| `horizontalConstraint` | `object` | - | `xs`, `s`, `m`, `l`, `xl`, `scale` | `scale` | Horizontal size limit of the tooltip |
| `children` | `node` | ✅ | - | - | Content rendered within the tooltip |
| `components` | `object` | - | `WrapperComponent`, `BodyComponent` | - | If passed, the tooltip will wrap your component with this element |
| `styles.body` | `object` | - | - | - | If passed, these styles will be spread onto the div surrounding the tooltip body |
Copy link
Contributor

Choose a reason for hiding this comment

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

the proptypes says it's required.
Should we update the propTypes, or the readme?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's required because it's set with a default though, so for the user it's not required.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for the explanation

Copy link
Contributor

@islam3zzat islam3zzat left a comment

Choose a reason for hiding this comment

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

Thanks Malcolm.
It gave me very hard times because of the jumping :D

@@ -29,4 +29,20 @@ const getAmountInputStyles = props => [
`,
];

export { getCurrencyLabelStyles, getAmountInputStyles };
const getHighPrecisionWrapperStyles = props => css`
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit just pass isDisabled? to be more specific? Not sure what the pattern is on UIKit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

@montezume montezume requested a review from filippobocik April 10, 2019 11:12
@montezume montezume force-pushed the ml-high-precision-money branch from 116a248 to d90361f Compare April 10, 2019 12:23
Copy link
Contributor

@pa3 pa3 left a comment

Choose a reason for hiding this comment

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

😍 🚀

@montezume montezume merged commit 1091426 into master Apr 11, 2019
@montezume montezume deleted the ml-high-precision-money branch April 11, 2019 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👨‍🎨 Status: UI/UX Review Requires review from design team 💅 Type: Enhancement Improves existing code 🚀 Type: New Feature Something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants