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

Schema-item #974

Merged
merged 7 commits into from
Aug 22, 2023
Merged

Schema-item #974

merged 7 commits into from
Aug 22, 2023

Conversation

ashwin-pc
Copy link
Member

@ashwin-pc ashwin-pc commented Aug 17, 2023

Description

Adds SchemaItem as an experimental component to OUI

Screenshot 2023-08-16 at 6 43 50 PM

Issues Resolved

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • All tests pass
    • yarn lint
    • yarn test-unit
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

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.

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>
Copy link
Contributor

@KrooshalUX KrooshalUX left a 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!
🎉 👶 🎉

Copy link
Contributor

@BSFishy BSFishy left a 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
Copy link
Contributor

@BSFishy BSFishy Aug 17, 2023

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)

Suggested change
margin: $ouiSize / 2 0; // To align with buttonIcon
margin: calc($ouiSize / 2) 0; // To align with buttonIcon

Copy link
Member

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

Copy link
Member Author

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;
Copy link
Contributor

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

Copy link
Member

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.

Copy link
Member Author

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 :)

Copy link
Member

@joshuarrrr joshuarrrr left a 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;
Copy link
Member

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
Copy link
Member

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

Comment on lines +45 to +52
.ouiButtonIcon {
opacity: 0;
transition: opacity $ouiAnimSpeedNormal $ouiAnimSlightResistance;

&:focus {
opacity: 1;
}
}
Copy link
Member

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?

Copy link
Member Author

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

Comment on lines +56 to +61
@include ouiBottomShadowSmall;
border: $ouiBorderThin;

&:hover {
background-color: tintOrShade($ouiColorLightestShade, 50%, 20%);
}
Copy link
Member

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?

Copy link
Member Author

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>
@ashwin-pc ashwin-pc merged commit f3d42ef into opensearch-project:main Aug 22, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 22, 2023
* 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
AMoo-Miki pushed a commit that referenced this pull request Aug 22, 2023
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OuiSchemaListItem & OuiSchemaList
4 participants