From 6e6c1cebcfa2fcfda1880a528d41c5e1b785bcf9 Mon Sep 17 00:00:00 2001 From: Javi Velasco Date: Thu, 5 Nov 2015 11:28:42 +0100 Subject: [PATCH 0001/1024] Pure dialog --- components/date_picker/dialog.jsx | 9 +- components/dialog/index.jsx | 95 ++++++++----------- components/dialog/readme.md | 29 +++--- components/time_picker/dialog.jsx | 15 +-- .../modules/examples/dialog_example_1.txt | 23 +++-- .../layout/main/modules/examples/example.txt | 18 ++-- spec/components/dialog.jsx | 27 +++--- spec/style.scss | 4 +- 8 files changed, 105 insertions(+), 115 deletions(-) diff --git a/components/date_picker/dialog.jsx b/components/date_picker/dialog.jsx index 40b191467..42ea77757 100644 --- a/components/date_picker/dialog.jsx +++ b/components/date_picker/dialog.jsx @@ -15,6 +15,7 @@ class CalendarDialog extends React.Component { }; state = { + active: false, date: this.props.initialDate, display: 'months', actions: [ @@ -36,16 +37,16 @@ class CalendarDialog extends React.Component { }; onDateCancel () { - this.refs.dialog.hide(); + this.setState({active: false}); } onDateSelected () { if (this.props.onDateSelected) this.props.onDateSelected(this.state.date); - this.refs.dialog.hide(); + this.setState({active: false}); } show () { - this.refs.dialog.show(); + this.setState({active: true}); } render () { @@ -53,7 +54,7 @@ class CalendarDialog extends React.Component { const headerClassName = `${style.header} ${style[display]}`; return ( - +
{time.getFullDayOfWeek(this.state.date.getDay())} diff --git a/components/dialog/index.jsx b/components/dialog/index.jsx index 2be9719c6..667169a45 100644 --- a/components/dialog/index.jsx +++ b/components/dialog/index.jsx @@ -2,61 +2,46 @@ import React from 'react'; import Button from '../button'; import style from './style'; -class Dialog extends React.Component { - static propTypes = { - actions: React.PropTypes.array, - active: React.PropTypes.bool, - className: React.PropTypes.string, - title: React.PropTypes.string, - type: React.PropTypes.string - }; - - static defaultProps = { - actions: [], - active: false, - type: 'normal' - }; - - state = { - active: this.props.active - }; - - renderActions () { - return this.props.actions.map((action, idx) => { - let className = style.button; - if (action.className) className += ` ${action.className}`; - return