-
Notifications
You must be signed in to change notification settings - Fork 14
Conversation
47adfea
to
0f74a3e
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.
Looks great, didn't take too close a look at the stepper component though, hopefully Justin Tim and Trevor can help pick up. gonna go grab breakfast
src/Input/InputWrapper.tsx
Outdated
}: Props): ReturnType<React.FC> { | ||
return ( | ||
<React.Fragment> | ||
<label |
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.
We might want to have <label/>
tag wrap the {label}
, {description}
, and {children}
(not the error or info messages though), it would automatically associate the text we're using to describe the input with the input box for accessibility (more info). It'd also give focus to the input when clicking on the title, which is imo desirable
Alternatively, we could use aria-label
or aria-labelledby
, but those are more of a hassle (need to associate them by id, generating unique ids for association is a bit more of a hassle than associating via nesting hierarchy)
646a4e8
to
430910e
Compare
src/Input/Input.story.tsx
Outdated
...typography.base.base, | ||
textTransform: "uppercase", | ||
fontWeight: 600, | ||
margin: 6, |
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.
Not sure where @adamatorres is on this, but 6 is not on the 4px grid. Considering this is a margin that will be applied on both sides of each axis, perhaps it's ok since the net effect is 12px 🤷♂
src/Input/Stepper.tsx
Outdated
} else if (newValue !== value) { | ||
setValue(newValue); | ||
} | ||
onChange(value); |
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 think this should be newValue
?
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.
We only want to call onChange with the value
if it changes, and in this case newValue
is the value the user has just tried to make the stepper. value
willonly change if thats a valid value, so I call onChange(value)
after all the logic determining if newValue
is valid is done and value is set. Does that make sense?
Hey @mayakoneval -- Here's some design feedback on the inputs:
|
3876d99
to
53b1bc8
Compare
A few thoughts from using the new Inputs.
|
I believe I fixed this with |
src/Input/InputWrapper.tsx
Outdated
<div {...otherProps}> | ||
<label | ||
css={{ | ||
paddingBottom: 8, |
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.
Imo in a component library, a components box should be no larger than it needs to be, padding/margins should be set by the people using the components. However, this is a lot less annoying once https://github.com/mdg-private/engine-frontend/pull/1577 or something analogous lands so 🤷♂
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.
@jgzuke From our space-kit
meetings, it seems that all apollo products want the same spacing / font etc and that is why we decided to create a component library, to be able to use components that already have padding / margins etc and have builtin descriptions / error states. If you need to override this padding, either space-kit
is wrong or the designs are not aligned! Let me know!
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.
@mayakoneval the designs in https://app.zeplin.io/project/5d375cd742170577784b28ca/screen/5d41d60764e8c22bd5aeac20 have a smaller padding between them than two stacked inputs (with no labels)
abe46a5
to
34a6717
Compare
34a6717
to
69de1fa
Compare
69de1fa
to
a0fdedc
Compare
This will stop us from getting errors in storybook while we're working. We don't need them, we have them in VS Code and CI
🚀 PR was released in v1.4.0 🚀 |
@@ -13,6 +13,7 @@ | |||
"clean:button": "rimraf Button", | |||
"clean:colors": "rimraf colors", | |||
"clean:fonts": "rimraf fonts", | |||
"clean:formField": "rimraf FormField", |
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 is no FormField anymore, so this npm script won't do anything.
@@ -61,6 +61,7 @@ _From #57_ | |||
- Edit Modal prop descriptions, fix margin top on children [#41](https://github.com/apollographql/space-kit/pull/41) | |||
- Export constant from `colors` instead of requiring `import * as colors` (#35) | |||
- Add Card component (#34) | |||
- Text Inputs and Steppers [(#45)](https://github.com/apollographql/space-kit/pull/45) |
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 doesn't include Steppers, that file has been deleted
/** | ||
* Visible title | ||
*/ | ||
label: React.ReactNode; |
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 don't think this should be necessary. Credit card form, for example
This PR includes:
Input Props
Stepper Props
Design
Ticket
Design Quip Doc
Points of conversation:
Stepper
onClick
accepts a number, while theInput
onClick
accepts anHTMLInputEvent
. This is because the Stepper should only callonChange
when the number has actually changed, not when the user makes an action in the input. For example, they could try to decrease the number but the number is at min already, so we don't want to callonClick
.Stepper
is copy pasted from Tim's implementation and then emotionified. However, I took the responsibility of updating the value away from the consumer and into the component. @timbotnik curious as to what you think of this.Is that okay? Note the icons are bottom aligned with the text, do you want the icons aligned
display:flex
style with the text so that when it wraps the icon is centered to the text like this?Or would you rather it be in line with the text?