极简触感反馈Button组件

一个简单的React触感反馈的button组件

import React from 'react';
import './index.scss';

class Button extends React.Component {
    static defaultProps = {
        className: '',
        children: null
    }

    render() {
        const {className, children, ...rest} = this.props;

        return <button className={`feedback-btn ${className}`} {...rest}>
            {children}
        </button>
    }
}

export default Button;
@charset 'utf-8';

.feedback-btn {
    outline: none;
    border: none;
    background-color: transparent;
    font-weight: inherit;
    text-align: inherit;

    &:active {
        opacity: 0.6;
    }
}
原文地址:https://www.cnblogs.com/ljwk/p/11866011.html