index.tsx 1.0 KB
Newer Older
ada committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
import * as React from "react"
import * as style from './style.scss'
export interface CardProps {
    backgroundBlock?: boolean; 
    headerImg?: boolean;
    style?: any; 
}

class Card extends React.Component<CardProps, {}> {
    static defaultProps = {
        backgroundBlock: true,
        headerImg: false,
        style: {}
    }

    render() {
        var contentStyle: any = {
            ...this.props.style
        }

        if (this.props.backgroundBlock) {
            contentStyle.background = 'rgba(2, 46, 98, .3)'
        }

        return <div className={style.content} style={contentStyle}>
            <div className={style.leftTop}></div>
            <div className={style.rightTop}></div>
            <div className={style.leftBottom}></div>
            <div className={style.rightBottom}></div>
            {
                this.props.headerImg 
                ? <div className={style.headerImg}></div>
                : null
            }
            {this.props.children}
        </div>
    }
}

export default Card;