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

Add dismissible prop to OuiCallOut #985

Merged

Conversation

abbyhu2000
Copy link
Member

@abbyhu2000 abbyhu2000 commented Aug 23, 2023

Description

Add optional prop dismissible to OuiCallOut.

Screen.Recording.2023-08-23.at.3.06.26.PM.mov

Issues Resolved

resolves #881

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: abbyhu2000 <[email protected]>
Copy link
Member

@ashwin-pc ashwin-pc left a comment

Choose a reason for hiding this comment

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

Nice! I like the change. Im okay with this as is, but have a few minor comments.

src-docs/src/views/call_out/info.js Outdated Show resolved Hide resolved
src/components/call_out/call_out.test.tsx Show resolved Hide resolved
src/components/call_out/call_out.tsx Outdated Show resolved Hide resolved
...rest
},
ref: Ref<HTMLDivElement>
) => {
const [isCalloutVisible, setIsCalloutVisible] = useState(true);
Copy link
Member

Choose a reason for hiding this comment

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

Can we persist this value in session storage?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is any precedence of using any sort of storage in OUI. In fact, I feel like a more common pattern would be to have a prop like showDismissIcon and onDismiss and let the builder handle the functionality. @KrooshalUX input might be helpful here

@joshuarrrr
Copy link
Member

@abbyhu2000 I assume you'll need this for OSD 2.10 release? If so, can you add it to #958?

@abbyhu2000 abbyhu2000 mentioned this pull request Aug 23, 2023
Signed-off-by: abbyhu2000 <[email protected]>

.ouiCallOut__closeIcon {
position: absolute;
right: 6px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this should use $ouiSize in some way. Maybe calc($ouiSizeM / 2)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to $ouiSizeS / 2

...rest
},
ref: Ref<HTMLDivElement>
) => {
const [isCalloutVisible, setIsCalloutVisible] = useState(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there is any precedence of using any sort of storage in OUI. In fact, I feel like a more common pattern would be to have a prop like showDismissIcon and onDismiss and let the builder handle the functionality. @KrooshalUX input might be helpful here

@abbyhu2000
Copy link
Member Author

@BSFishy Yea I called it out in the original issue too about making onDismiss a prop and let user decide the functionality. #880 (comment)

i am okay with either implementation.

@ashwin-pc
Copy link
Member

I don't think there is any precedence of using any sort of storage in OUI. In fact, I feel like a more common pattern would be to have a prop like showDismissIcon and onDismiss and let the builder handle the functionality. @KrooshalUX input might be helpful here

OUI is already far from a purely stylistic component library with many of its components having a lot of state information stored. While i do agree that we can control the state from outside the component, the reason I asked Abby to implement it this way was to make using this feature as easy as possible for the average developer. If in future we want to relegate control to outside the application, we can always expand the capability to do so. e.g. This is similar to React's controlled and uncontrolled components philosophy.

Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: abbyhu2000 <[email protected]>
@joshuarrrr joshuarrrr merged commit 53ad3e7 into opensearch-project:main Aug 29, 2023
6 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Aug 29, 2023
* add dismissible prop to OuiCallOut

Signed-off-by: abbyhu2000 <[email protected]>

* changelog

Signed-off-by: abbyhu2000 <[email protected]>

* fix some nits

Signed-off-by: abbyhu2000 <[email protected]>

* change size to oui size

Signed-off-by: abbyhu2000 <[email protected]>

* no state management in oui

Signed-off-by: abbyhu2000 <[email protected]>

---------

Signed-off-by: abbyhu2000 <[email protected]>
(cherry picked from commit 53ad3e7)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
ashwin-pc pushed a commit that referenced this pull request Aug 29, 2023
* add dismissible prop to OuiCallOut

Signed-off-by: abbyhu2000 <[email protected]>

* changelog

Signed-off-by: abbyhu2000 <[email protected]>

* fix some nits

Signed-off-by: abbyhu2000 <[email protected]>

* change size to oui size

Signed-off-by: abbyhu2000 <[email protected]>

* no state management in oui

Signed-off-by: abbyhu2000 <[email protected]>

---------

Signed-off-by: abbyhu2000 <[email protected]>
(cherry picked from commit 53ad3e7)
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.

(Meta) Update OuiCallOut Behavior
4 participants