-
Notifications
You must be signed in to change notification settings - Fork 844
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
converts EuiCode and EuiCodeBlock to TypeScript (#2835)
* fix for setMaxListeners Mutation Notifier * converts EuiCode and EuiCodeBlock to TypeScript * adds changelog entry * undoes String cast per review feedback * moves prop exports to `index.ts` and removes `index.d.ts` #2835 (comment) * uses `keysOf` per review feedback * uses `HTMLCodeElement` custom type per review feedback * single source of truth for `FontSize` and `PaddingSize` * uses `HTMLElement` directly instead of `HTMLCodeElement` alias * exports entire props definition for EuiCodeBlock * switches precedence of exported Props for EuiCodeProps per review feedback
- Loading branch information
1 parent
0b312d9
commit 11d0a47
Showing
20 changed files
with
145 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
src/components/code/_code_block.test.js → src/components/code/_code_block.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/components/code/code.test.js → src/components/code/code.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { CommonProps } from '../common'; | ||
|
||
import React, { FunctionComponent, HTMLAttributes } from 'react'; | ||
|
||
import { EuiCodeBlockImpl } from './_code_block'; | ||
|
||
export type FontSize = 's' | 'm' | 'l'; | ||
export type PaddingSize = 'none' | 's' | 'm' | 'l'; | ||
|
||
export 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; | ||
isCopyable?: boolean; | ||
} | ||
|
||
interface Props extends EuiCodeSharedProps { | ||
inline?: true; | ||
} | ||
|
||
export type EuiCodeProps = CommonProps & Props & HTMLAttributes<HTMLElement>; | ||
|
||
export const EuiCode: FunctionComponent<EuiCodeProps> = ({ | ||
inline, | ||
...rest | ||
}) => { | ||
return <EuiCodeBlockImpl inline={true} {...rest} />; | ||
}; |
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
src/components/code/code_block.test.js → src/components/code/code_block.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.