UNPKG

saagie-ui

Version:

Saagie UI from Saagie Design System

45 lines (37 loc) 1.04 kB
import React, { forwardRef } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; const propTypes = { /** * The className property allows you to add more classes to the component. */ className: PropTypes.string, /** * The CallOutTitle content. */ children: PropTypes.node, /** * The component default class. */ defaultClassName: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]), /** * The component used for the root node. * Either a string to use a DOM element or a component. */ tag: PropTypes.elementType, }; const defaultProps = { children: '', className: '', defaultClassName: 'sui-m-call-out__title', tag: 'div', }; export const CallOutTitle = forwardRef(({ children, className, defaultClassName, tag: Tag, ...props }, ref) => ( <Tag className={classnames(defaultClassName, className)} {...props} ref={ref}> {children} </Tag> )); CallOutTitle.propTypes = propTypes; CallOutTitle.defaultProps = defaultProps;