import classNames from 'classnames' import PropTypes, { InferProps } from 'prop-types' import React from 'react' import { View, Text } from '@tarojs/components' import { AtDividerProps } from '../../../types/divider' import { mergeStyle, pxTransform } from '../../common/utils' export default class AtDivider extends React.Component { public static defaultProps: AtDividerProps public static propTypes: InferProps public render(): JSX.Element { const { className, customStyle, content, height, fontColor, fontSize, lineColor } = this.props const rootStyle = { ...(height ? { height: pxTransform(Number(height)) } : {}) } const fontStyle = { ...(fontColor ? { color: fontColor } : {}), ...(fontSize ? { fontSize: pxTransform(Number(fontSize)) } : {}) } const lineStyle: React.CSSProperties = { ...(lineColor ? { backgroundColor: lineColor } : {}) } return ( {content ? ( {content} ) : ( {this.props.children} )} ) } } AtDivider.defaultProps = { content: '', height: 0, fontColor: '', fontSize: 0, lineColor: '' } AtDivider.propTypes = { customStyle: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), className: PropTypes.oneOfType([PropTypes.array, PropTypes.string]), content: PropTypes.string, height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), fontColor: PropTypes.string, fontSize: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), lineColor: PropTypes.string }