|
@ -7,7 +7,7 @@ import cn from 'classnames'; |
|
|
import {IconWarning} from '../Icon/IconWarning'; |
|
|
import {IconWarning} from '../Icon/IconWarning'; |
|
|
import {IconError} from '../Icon/IconError'; |
|
|
import {IconError} from '../Icon/IconError'; |
|
|
|
|
|
|
|
|
type LogLevel = 'info' | 'warning' | 'error'; |
|
|
type LogLevel = 'warning' | 'error' | 'info'; |
|
|
|
|
|
|
|
|
interface ConsoleBlockProps { |
|
|
interface ConsoleBlockProps { |
|
|
level?: LogLevel; |
|
|
level?: LogLevel; |
|
@ -29,14 +29,11 @@ const Box = ({ |
|
|
); |
|
|
); |
|
|
Box.displayName = 'Box'; |
|
|
Box.displayName = 'Box'; |
|
|
|
|
|
|
|
|
function ConsoleBlock({level = 'info', children}: ConsoleBlockProps) { |
|
|
function ConsoleBlock({level = 'error', children}: ConsoleBlockProps) { |
|
|
let message: string | undefined; |
|
|
let message: React.ReactNode | null; |
|
|
if (typeof children === 'string') { |
|
|
if (typeof children === 'string') { |
|
|
message = children; |
|
|
message = children; |
|
|
} else if ( |
|
|
} else if (React.isValidElement(children)) { |
|
|
React.isValidElement(children) && |
|
|
|
|
|
typeof children.props.children === 'string' |
|
|
|
|
|
) { |
|
|
|
|
|
message = children.props.children; |
|
|
message = children.props.children; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|