import React, { HTMLAttributes } from 'react'; import './index.scss'; export interface TextProps extends HTMLAttributes { children?: React.ReactNode; strong?: boolean; code?: boolean; keyboard?: boolean; mark?: boolean; } const Text: React.FC = (props) => { const { children, strong, keyboard, mark, code, ...rest } = props; const render = () => { if (strong) { return {children}; } if (keyboard) { return {children}; } if (mark) { return {children}; } if (code) { return {children}; } }; return (
{render()}
); }; Text.defaultProps = { children: '', strong: false, code: false, keyboard: false, mark: false }; export default Text;