nexxtway/react-rainbow

View on GitHub
src/components/Notification/description.js

Summary

Maintainability
A
40 mins
Test Coverage
import React from 'react';
import PropTypes from 'prop-types';
import StyledDescription from './styled/description';

export default function Description({ text }) {
    if (typeof text === 'string') {
        return <StyledDescription>{text}</StyledDescription>;
    }
    return text;
}

Description.propTypes = {
    text: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
};

Description.defaultProps = {
    text: null,
};