import React from 'react'; import PropTypes from 'prop-types'; import _ from 'lodash'; import { ThemeProvider } from 'styled-components'; import { Props } from './interfaces'; import { FrancoButton } from './components/FrancoButton/FrancoButton'; import { Container, FullSizeContentContainer, Title, Content, LeftPartContainer, ButtonsContainer, TooltipContainer, } from './styledComponents'; import { getTheme } from '../utils/theme'; import Label from '../Label'; import Tooltip from '../Tooltip'; const Franco = (props: Props): JSX.Element => { const { theme, color, type, title, content, labelContent, contentColor, background, width, labelTooltip, buttons, infoTooltip, hasBorder, } = props; return ( {content !== '' && title === '' && labelContent === '' && ( {content} )} {content !== '' && title !== '' && ( <> {title} {!!infoTooltip && ( <TooltipContainer> <Tooltip text={infoTooltip} /> </TooltipContainer> )} {content} {labelContent !== '' && ( )} {!_.isEmpty(buttons) && ( {buttons.map((button, index) => ( ))} )} )} ); }; Franco.propTypes = { // eslint-disable-next-line react/forbid-prop-types theme: PropTypes.objectOf(PropTypes.any), color: PropTypes.string, type: PropTypes.string, title: PropTypes.string, content: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), labelContent: PropTypes.oneOfType([PropTypes.string, PropTypes.object]), contentColor: PropTypes.string, background: PropTypes.string, width: PropTypes.string, labelTooltip: PropTypes.string, infoTooltip: PropTypes.string, buttons: PropTypes.arrayOf( PropTypes.shape({ icon: PropTypes.string.isRequired, title: PropTypes.string.isRequired, render: PropTypes.func.isRequired, }) ), hasBorder: PropTypes.bool, }; Franco.defaultProps = { theme: null, color: null, background: null, type: 'plain', title: '', content: '', labelContent: '', contentColor: null, width: '240px', labelTooltip: '', infoTooltip: '', buttons: [], hasBorder: false, }; export default Franco;