From fc1a8c00dc9427da0e367b57ec571ac7224236b7 Mon Sep 17 00:00:00 2001 From: minwe Date: Tue, 10 May 2016 17:53:40 +0800 Subject: [PATCH] add Modal customized example --- kitchen-sink/pages/ModalExample.js | 103 +++++++++++++++++++++++++++++ src/scss/components/_modal.scss | 2 +- 2 files changed, 104 insertions(+), 1 deletion(-) diff --git a/kitchen-sink/pages/ModalExample.js b/kitchen-sink/pages/ModalExample.js index 6f1a7fd..e2fb572 100644 --- a/kitchen-sink/pages/ModalExample.js +++ b/kitchen-sink/pages/ModalExample.js @@ -4,9 +4,11 @@ import { Container, Group, Button, + ButtonGroup, Modal, Field, List, + Icon, } from 'amazeui-touch'; const ModalExample = React.createClass({ @@ -89,6 +91,105 @@ const ModalExample = React.createClass({ } }); +const LoginModal = React.createClass({ + getInitialState() { + return { + isOpen: false, + }; + }, + + open() { + this.setState({ + isOpen: true, + }) + }, + + close() { + this.setState({ + isOpen: false, + }); + }, + + handleLogin(e) { + let userName = this.refs.userName; + let pwd = this.refs.pwd; + + if (!userName.getValue() || !pwd.getValue()) { + this.setState({ + invalid: true + }); + + userName.getFieldDOMNode().focus(); + return; + } + + this.setState({ + invalid: false + }, () => { + console.info('Valid, do something else.'); + this.close(); + }); + }, + + render() { + return ( + + + + + } + nested="input" + > + + + } + nested="input" + > + + + + {this.state.invalid ?

请填写相关信息

: null} + + + + +
+
+ ); + } +}); + const ModalExamples = React.createClass({ render() { return ( @@ -212,6 +313,8 @@ const ModalExamples = React.createClass({

+ + ); } diff --git a/src/scss/components/_modal.scss b/src/scss/components/_modal.scss index d4f472a..f5c9014 100644 --- a/src/scss/components/_modal.scss +++ b/src/scss/components/_modal.scss @@ -99,7 +99,7 @@ padding-bottom: .5em; } - :last-child { + > :last-child { margin-bottom: 0 !important; }