wix-style-react
Version:
wix-style-react
37 lines • 1.83 kB
JavaScript
import React from 'react';
import PropTypes from 'prop-types';
import Text from '../../Text';
import Box from '../../Box';
import { st, classes } from './Subheader.st.css';
import { isString } from '../../utils/StringUtils';
import deprecationLog from '../../utils/deprecationLog';
class Subheader extends React.PureComponent {
constructor() {
super(...arguments);
deprecationLog('Card.Subheader is deprecated and will be removed in the next major version. Please use SectionHeader instead.');
}
render() {
const { dataHook, title, suffix, skin } = this.props;
return (React.createElement("div", { "data-hook": dataHook, className: st(classes.root, {
skin,
}) },
React.createElement(Box, { verticalAlign: "middle", flexGrow: 1, overflow: "hidden" }, isString(title) ? (React.createElement(Text, { ellipsis: true, weight: "normal", size: "medium", dataHook: "title" }, title)) : (React.createElement("div", { "data-hook": "title-node" }, title))),
suffix && (React.createElement("div", { className: classes.suffix, "data-hook": "suffix-node" }, suffix))));
}
}
Subheader.displayName = 'Card.Subheader';
Subheader.defaultProps = {
skin: 'standard',
};
Subheader.propTypes = {
/** Applies a data-hook HTML attribute to be used in the tests */
dataHook: PropTypes.string,
/** Sets a title text value. Title can also be overridden to any other component. */
title: PropTypes.node.isRequired,
/** Adds an empty container on the right side of a subheader. Commonly used to store action buttons or an info icon. */
suffix: PropTypes.node,
/** Controls the background color of a subheader */
skin: PropTypes.oneOf(['standard', 'neutral']),
};
export default Subheader;
//# sourceMappingURL=Subheader.js.map