index.js 748 Bytes
Newer Older
zhanghaozhe committed
1 2 3 4 5
import React, { Component } from 'react';
import './exchange-bar.scss'
import Input from '../Input'
import classnames from 'classnames'

zhanghaozhe committed
6
class RedeemBar extends Component {
zhanghaozhe committed
7
    state = {}
zhanghaozhe committed
8 9

    render() {
zhanghaozhe committed
10
        const {onChange, redeemCode, exchange} = this.props
zhanghaozhe committed
11 12 13 14 15
        return (
            <div className="exchange-bar">
                <Input
                    placeholder={'请输入优惠码'}
                    onChange={onChange}
zhanghaozhe committed
16
                    value={redeemCode}
zhanghaozhe committed
17 18
                />
                <button className={classnames({
zhanghaozhe committed
19
                    active: redeemCode && redeemCode.length > 0
zhanghaozhe committed
20
                })} onClick={exchange}>兑换
zhanghaozhe committed
21 22 23 24 25 26
                </button>
            </div>
        );
    }
}

zhanghaozhe committed
27
export default RedeemBar;