1.0.0 • Published 5 years ago

@irim/sidebar v1.0.0

Weekly downloads
-
License
BSD-3-Clause
Repository
-
Last release
5 years ago

side-popup

version license downloads

快速使用

  • $ tnpm install @irim/sidebar --save
import SidePopup from '@irim/sidebar';

class Demo extends React.Component {
  state = {
    visible: false,
  };

  handleClick = () => {
    this.setState({ visible: !this.state.visible });
  }

  handleClose = (fromAction) => {
    this.setState({ visible: false });
  }

  render() {
    return (
      <div className="demo-container">
        <button className="toggle-btn" onClick={this.handleClick}>show</button>
        <button className="x-safe-node">I'm safe node</button>
        <SidePopup visible={this.state.visible}
          onClose={this.handleClose} title="Title of Popup">
          <h4>I am content title</h4>
          <p>I am content body~~</p>
        </SidePopup>
      </div>
    );
  }
}

ReactDOM.render(<Demo />, mountNode);
@import "~@irim/sidebar/lib/index"; 

API

propsdesctyperequireddefault
titleheader titlestringnonull
defaultVisiblevisible when initbooleanno-
visiblevisible of popupbooleanno-
onCloseevent for popup closefunctionnonoop
closablewhether has close btnbooleannotrue
hasMaskshow mask when popup showingbooleannofalse
offsetTopoffset of topnumberno0
autoFocusauto focus to form elementbooleannofalse
dirshow directionenum(right, left)no'right'
cacheBodyhold body when popup is hiddenbooleannotrue
rootroot node for outer clickDOMElementno#root or body
safeNodesafe node that ignore outer clickArrayno[]

SCSS Variables

在引用样式前提前定义即可修改变量

$x-sidebar-color-header: #F2F2F2; // 头部背景色
$x-sidebar-color-title: #666666; // 头部标题文字颜色
$x-sidebar-color-primary: #EB8A00; // 关闭按钮 HOVER 颜色
$x-sidebar-size-default: 600px; // 默认宽度
$x-sidebar-size-min: 480px; // 最小宽度
$x-sidebar-offset-top: 0; // 默认顶部距离
$x-sidebar-offset-bottom: 1px; // 默认底部距离
$x-sidebar-zindex: 1001; // 层高

LICENSE

BSD-3-Clause License

1.0.0

5 years ago

1.0.0-beta.1

5 years ago