-
Notifications
You must be signed in to change notification settings - Fork 73
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
Schema-item #974
Schema-item #974
Conversation
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
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.
👏 👏 👏 👏
Welcome to the world, SchemaItem!
🎉 👶 🎉
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 good overall, just a few nits! If this needs to get in soon, I'd be fine with pushing this through and making most/all of my comments into followup issues since this component is marked as experimental
|
||
.ouiSchemaItem__icon { | ||
align-self: flex-start; | ||
margin: $ouiSize / 2 0; // To align with buttonIcon |
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 division will need to be surrounded by calc()
, for sass upgrade (also makes it clearer where the calculation is taking place :P)
margin: $ouiSize / 2 0; // To align with buttonIcon | |
margin: calc($ouiSize / 2) 0; // To align with buttonIcon |
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 feels like a little bit of a hack? I think there are some existing approaches to align with buttons, although maybe I'm just thinking of https://oui.opensearch.org/1.0/#/navigation/button#empty-button
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.
@joshuarrrr I know why you feel that way, because i felt it too when i was implementing it. Open to suggestions here and probably can be improved in a followup, but the root of the problem here is that ButtonIcons have an margin that we need to match and unfortunately this is the best way i could find to do it in both the compressed and uncompressed mode.
/** Whether the item is compressed. */ | ||
compressed?: boolean; | ||
/** Whether the item is displayed with a panel. */ | ||
withPanel?: 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.
Is there precedence for using with
? I feel like a more common naming convention would be hasPanel
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.
droppable
uses withPanel
contextMenu
uses hasPanel
pageBody
uses panelled
So I don't think we have a consistent pattern today. Seeing that the current implementation is pure style (and doesn't actually use existing panel components or classes), I think I'd maybe choose withPanelStyling
or something like that.
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'd personally avoid withPanelStyling
since its unnecessarily long, but im okay with withPanel
, hasPanel
or even panelled
. Whichever you want to align on. From a user's perspective, as long as it does what the docs say, i dont care as much what its called :)
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 good - mostly some questions around styling and alignment. The major thing missing is tests.
/** Whether the item is compressed. */ | ||
compressed?: boolean; | ||
/** Whether the item is displayed with a panel. */ | ||
withPanel?: 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.
droppable
uses withPanel
contextMenu
uses hasPanel
pageBody
uses panelled
So I don't think we have a consistent pattern today. Seeing that the current implementation is pure style (and doesn't actually use existing panel components or classes), I think I'd maybe choose withPanelStyling
or something like that.
|
||
.ouiSchemaItem__icon { | ||
align-self: flex-start; | ||
margin: $ouiSize / 2 0; // To align with buttonIcon |
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 feels like a little bit of a hack? I think there are some existing approaches to align with buttons, although maybe I'm just thinking of https://oui.opensearch.org/1.0/#/navigation/button#empty-button
.ouiButtonIcon { | ||
opacity: 0; | ||
transition: opacity $ouiAnimSpeedNormal $ouiAnimSlightResistance; | ||
|
||
&:focus { | ||
opacity: 1; | ||
} | ||
} |
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.
Is there not an existing mixin to use for 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.
I copied this over from ListGroup. I dont think it used one, but if there is one I will update it
@include ouiBottomShadowSmall; | ||
border: $ouiBorderThin; | ||
|
||
&:hover { | ||
background-color: tintOrShade($ouiColorLightestShade, 50%, 20%); | ||
} |
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 naming of this seems a little fishy. I would expect the component prop to just wrap itself with https://oui.opensearch.org/1.0/#/layout/panel. This is just adding border and a hover background color. Is it intended to actually leverage/mimic existing panel styles or is it just a different styling for this component?
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.
It is, but its style is different from a normal panel. Based on @KrooshalUX's mock in the parent issue, the colors here come from other similar components and they do it this way. We can probably reuse them, but given that OUI components are mostly atomic anyways, i dont think its a big deal to redefine them unless we are certain that this is actually a composed view of other atomic components.
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com>
* Adds SchemaItem Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * updates snapshot Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * Adds changelog entry Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * push fix changelog Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * Address PR comments Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit f3d42ef) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md
* Adds SchemaItem Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * updates snapshot Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * Adds changelog entry Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * push fix changelog Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> * Address PR comments Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> --------- Signed-off-by: Ashwin P Chandran <ashwinpc@amazon.com> (cherry picked from commit f3d42ef) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> # Conflicts: # CHANGELOG.md Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
Adds SchemaItem as an experimental component to OUI
Issues Resolved
Check List
yarn lint
yarn test-unit
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.