import { View } from '@tarojs/components'
import styles from './index.module.less'
import React  from 'react';

/**
 * 分割线
 */

type props = {
    text?: string,       // 分割线上的文字
    backColor?: string,  // 背景色
    site?: string,       // 位置
    lineColor?: string   // 线的颜色
}

const Divider = (props: props) => {
    let { text, site = "center", backColor = "#FFF", lineColor = "#EDEDED" } = props

    return <View className={styles.divider} style={{backgroundColor: lineColor}}>
        {
            text && <View className={`${styles['text']} ${styles[site]}`} style={{backgroundColor: backColor}}>{text}</View>
        }
    </View>
}

export default React.memo(Divider)