DocSpace-client/packages/asc-web-components/text/index.js

69 lines
1.5 KiB
JavaScript
Raw Normal View History

import React from "react";
import PropTypes from "prop-types";
import StyledText from "./styled-text";
const Text = ({
title,
tag,
as,
fontSize,
fontWeight,
color,
textAlign,
2021-04-13 09:43:17 +00:00
className,
...rest
}) => {
return (
<StyledText
fontSizeProp={fontSize}
fontWeightProp={fontWeight}
colorProp={color}
2020-07-14 09:54:11 +00:00
textAlign={textAlign}
as={!as && tag ? tag : as}
title={title}
2021-04-13 09:43:17 +00:00
className={`${className} not-selectable`}
{...rest}
/>
);
};
Text.propTypes = {
/** Sets the tag through which to render the component */
as: PropTypes.string,
tag: PropTypes.string,
/** Title */
title: PropTypes.string,
/** Specifies the text color */
color: PropTypes.string,
/** Sets the 'text-align' property */
2020-07-14 09:54:11 +00:00
textAlign: PropTypes.string,
/** Sets the font size */
fontSize: PropTypes.string,
/** Sets the font weight */
fontWeight: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
/** Sets background color */
backgroundColor: PropTypes.string,
/** Disables word wrapping */
truncate: PropTypes.bool,
/** Sets font weight value to bold */
isBold: PropTypes.bool,
/** Sets the 'display: inline-block' property */
isInline: PropTypes.bool,
/** Sets the font style */
isItalic: PropTypes.bool,
/** Sets the 'display' property */
display: PropTypes.string,
};
Text.defaultProps = {
title: null,
textAlign: "left",
fontSize: "13px",
truncate: false,
isBold: false,
isInline: false,
isItalic: false,
};
export default Text;