-
Notifications
You must be signed in to change notification settings - Fork 841
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 types for EuiEmptyPrompt, EuiCode(Block), EuiCallOut #1010
Add types for EuiEmptyPrompt, EuiCode(Block), EuiCallOut #1010
Conversation
type Size = 's' | 'm'; | ||
|
||
export interface EuiCallOutProps { | ||
title?: 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.
Hmm, the title
prop collides with the title
attribute from HTMLAttributes<HTMLDivElement>
, so TypeScript seems to be requiring that values in that prop meet both ReactNode
and string
which is weird... Experimenting...
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.
Okay, I just removed HTMLAttributes<HTMLDivElement>
from the prop types signature for now, we can always add specific properties down the road if needed.
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.
You can keep using HTMLAttributes and use Omit (defined in common.d.ts) to omit the original title prop
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.
Awesome, I figured there must be a way to do that, couldn't figure it out.
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.
LGTM (all the props are there), but I defer to @chandlerprall when it comes to TypeScript.
CHANGELOG.md
Outdated
@@ -3,6 +3,7 @@ | |||
- Make some proprties of `EuiFlyout` optional ([#1003](https://github.com/elastic/eui/pull/1003)) | |||
- Add typings for `EuiFlyout`, `EuiFlyoutBody`, `EuiFlyoutHeader`, and `EuiFlyoutFooter` ([#1001](https://github.com/elastic/eui/pull/1001)) | |||
- Gave `EuiFlyout` close button a data-test-subj ([#1000](https://github.com/elastic/eui/pull/1000)) | |||
- Add typings for `EuiEmptyPrompt`, `EuiCode`, `EuiCodeBlock`, and `EuiCallOut` ([#1010](https://github.com/elastic/eui/pull/1010)) |
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.
Be sure to use past-tense in the changelog.
iconType?: IconType; | ||
iconColor?: IconColor; | ||
title?: ReactNode; | ||
titleSize?: EuiTitleSize; |
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.
Hmm, eventually it looks like we'll need to align our naming. Some of these are prefixed and some are not.
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.
LGTM!
…ompt-EuiCodeBlock-EuiCallOut
This PR adds type definitions for the
<EuiEmptyPrompt>
,<EuiCode>
,<EuiCodeBlock>
, and<EuiCallOut>
. All components are pretty straight forward.