-
Notifications
You must be signed in to change notification settings - Fork 843
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EuiGlobalToastListItem
convert to TS (#1880)
* `EuiGlobalToastListItem` convert to TS * `EuiGlobalToastListItem` code review fixes * `EuiGlobalToastListItem` updated Changelog * `EuiGlobalToastListItem` code review fix
- Loading branch information
1 parent
d6a299e
commit 86b5e64
Showing
6 changed files
with
45 additions
and
38 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.
This file was deleted.
Oops, something went wrong.
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,28 @@ | ||
import { cloneElement, FunctionComponent, ReactElement } from 'react'; | ||
import classNames from 'classnames'; | ||
import { CommonProps } from '../common'; | ||
|
||
export interface EuiGlobalToastListItemProps { | ||
isDismissed?: boolean; | ||
children?: ReactElement; | ||
} | ||
|
||
export const EuiGlobalToastListItem: FunctionComponent< | ||
CommonProps & EuiGlobalToastListItemProps | ||
> = ({ children, isDismissed }) => { | ||
if (!children) { | ||
return null; | ||
} | ||
const classes = classNames( | ||
'euiGlobalToastListItem', | ||
children.props.className, | ||
{ | ||
'euiGlobalToastListItem-isDismissed': isDismissed, | ||
} | ||
); | ||
|
||
return cloneElement(children, { | ||
...children.props, | ||
...{ className: classes }, | ||
}); | ||
}; |
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