From a2cc04cff466607d12080c688fcde3d655089b46 Mon Sep 17 00:00:00 2001 From: Javi Velasco Date: Sun, 22 May 2016 13:26:30 +0200 Subject: [PATCH] Add Clock and ClockHours to TimePicker migration --- components/time_picker/Clock.js | 15 +++++++++++---- components/time_picker/ClockHours.js | 6 +++++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/components/time_picker/Clock.js b/components/time_picker/Clock.js index b5bae57e..ecc0fad1 100644 --- a/components/time_picker/Clock.js +++ b/components/time_picker/Clock.js @@ -1,7 +1,6 @@ import React from 'react'; import CssTransitionGroup from 'react-addons-css-transition-group'; import { ZoomIn, ZoomOut } from '../animations'; -import style from './style.clock'; import time from '../utils/time'; import Hours from './ClockHours'; import Minutes from './ClockMinutes'; @@ -13,6 +12,11 @@ class Clock extends React.Component { format: React.PropTypes.oneOf(['24hr', 'ampm']), onChange: React.PropTypes.func, onHandMoved: React.PropTypes.func, + theme: React.PropTypes.shape({ + clock: React.PropTypes.string.isRequired, + clockWrapper: React.PropTypes.string.isRequired, + placeholder: React.PropTypes.string.isRequired + }), time: React.PropTypes.object }; @@ -81,6 +85,7 @@ class Clock extends React.Component { selected={this.props.time.getHours()} spacing={this.state.radius * 0.18} onHandMoved={this.props.onHandMoved} + theme={this.props.theme} /> ); } @@ -94,17 +99,19 @@ class Clock extends React.Component { selected={this.props.time.getMinutes()} spacing={this.state.radius * 0.18} onHandMoved={this.props.onHandMoved} + theme={this.props.theme} /> ); } render () { + const { theme } = this.props; const animation = this.props.display === 'hours' ? ZoomOut : ZoomIn; return ( -
-
+
+
-
+
{this.props.display === 'hours' ? this.renderHours() : null} {this.props.display === 'minutes' ? this.renderMinutes() : null}
diff --git a/components/time_picker/ClockHours.js b/components/time_picker/ClockHours.js index a1c2491f..50a6a214 100644 --- a/components/time_picker/ClockHours.js +++ b/components/time_picker/ClockHours.js @@ -16,7 +16,8 @@ class Hours extends React.Component { onHandMoved: React.PropTypes.func, radius: React.PropTypes.number, selected: React.PropTypes.number, - spacing: React.PropTypes.number + spacing: React.PropTypes.number, + theme: React.PropTypes.object }; state = { @@ -59,6 +60,7 @@ class Hours extends React.Component { numbers={innerNumbers} spacing={this.props.spacing} radius={innerRadius} + theme={this.props.theme} active={this.props.selected} /> ); @@ -79,12 +81,14 @@ class Hours extends React.Component { radius={radius} twoDigits={is24hr} active={is24hr ? selected : (selected % 12 || 12)} + theme={this.props.theme} /> {this.renderInnerFace(radius - spacing * innerSpacing)}