-
Notifications
You must be signed in to change notification settings - Fork 841
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
- Loading branch information
1 parent
064e7c8
commit d4781e7
Showing
17 changed files
with
146 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
File renamed without changes.
File renamed without changes.
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
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,39 @@ | ||
import { CommonProps } from '../common'; | ||
|
||
import React, { FunctionComponent, HTMLAttributes } from 'react'; | ||
|
||
import { EuiCodeBlockImpl } from './_code_block'; | ||
|
||
/** | ||
* There isn't a specific type for the <code> element, and MDN says that it only supports the HTMLElement interface. | ||
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code | ||
* */ | ||
export type HTMLCodeElement = HTMLElement; | ||
|
||
type FontSize = 's' | 'm' | 'l'; | ||
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; | ||
} | ||
|
||
export interface EuiCodeProps extends EuiCodeSharedProps { | ||
inline?: true; | ||
} | ||
|
||
type Props = CommonProps & EuiCodeProps & HTMLAttributes<HTMLCodeElement>; | ||
|
||
export const EuiCode: FunctionComponent<Props> = ({ 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.