-
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
Changes from 4 commits
f445276
9397296
042560f
93886bf
ecf2de3
b22189b
c56ed86
5430177
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="../common.d.ts" /> | ||
/// <reference path="../icon/index.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* EuiCallOut type defs | ||
* | ||
* @see './code.js' | ||
*/ | ||
|
||
type Color = 'primary' | 'success' | 'warning' | 'danger'; | ||
type Size = 's' | 'm'; | ||
|
||
export interface EuiCallOutProps { | ||
title?: ReactNode, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I just removed There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||
iconType?: IconType, | ||
color?: Color, | ||
size?: Size, | ||
} | ||
|
||
export const EuiCallOut: SFC< | ||
CommonProps & EuiCallOutProps & HTMLAttributes<HTMLDivElement> | ||
>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/// <reference path="../common.d.ts" /> | ||
|
||
import { SFC, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
type FontSize = 's' | 'm' | 'l'; | ||
type PaddingSize = 'none' | 's' | 'm' | 'l'; | ||
|
||
// there isn't a specific type for the <code> element, and MDN | ||
// says that it only supports the HTMLElement interface | ||
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code | ||
type HTMLCodeElement = HTMLElement | ||
|
||
interface EuiCodeSharedProps { | ||
paddingSize?: PaddingSize; | ||
|
||
/** | ||
* Sets the syntax highlighting for a specific language | ||
* See http://highlightjs.readthedocs.io/en/latest/css-classes-reference.html#language-names-and-aliases | ||
* for options | ||
*/ | ||
language?: string; | ||
|
||
overflowHeight?: number; | ||
fontSize?: FontSize; | ||
transparentBackground?: boolean; | ||
} | ||
|
||
|
||
/** | ||
* EuiCode type defs | ||
* | ||
* @see './code.js' | ||
*/ | ||
|
||
export interface EuiCodeProps extends EuiCodeSharedProps { | ||
inline?: true | ||
} | ||
|
||
export const EuiCode: SFC< | ||
CommonProps & EuiCodeProps & HTMLAttributes<HTMLCodeElement> | ||
>; | ||
|
||
/** | ||
* EuiCodeBlock type defs | ||
* | ||
* @see './code_block.js' | ||
*/ | ||
|
||
export interface EuiCodeBlockProps extends EuiCodeSharedProps { | ||
inline?: false | ||
} | ||
|
||
export const EuiCodeBlock: SFC< | ||
CommonProps & EuiCodeBlockProps & HTMLAttributes<HTMLCodeElement> | ||
>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/// <reference path="../common.d.ts" /> | ||
/// <reference path="../icon/index.d.ts" /> | ||
/// <reference path="../title/index.d.ts" /> | ||
|
||
import { SFC, ReactNode, HTMLAttributes } from 'react'; | ||
|
||
declare module '@elastic/eui' { | ||
/** | ||
* EuiEmptyPrompt type defs | ||
* | ||
* @see './empty_prompt.js' | ||
*/ | ||
|
||
export interface EuiEmptyPromptProps { | ||
iconType?: IconType; | ||
iconColor?: IconColor; | ||
title?: ReactNode; | ||
titleSize?: EuiTitleSize; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
body?: ReactNode; | ||
actions?: ReactNode; | ||
} | ||
|
||
export const EuiEmptyPrompt: SFC< | ||
CommonProps & EuiEmptyPromptProps & HTMLAttributes<HTMLDivElement> | ||
>; | ||
} |
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.