1+ var React = require ( 'react' ) ;
2+ var StylePropable = require ( '../mixins/style-propable' ) ;
3+ var EnhancedButton = require ( '../enhanced-button' ) ;
4+ var Transitions = require ( '../styles/transitions' ) ;
5+
6+ var ClockButton = React . createClass ( {
7+
8+ mixins : [ StylePropable ] ,
9+
10+ contextTypes : {
11+ theme : React . PropTypes . object
12+ } ,
13+
14+ propTypes : {
15+ position : React . PropTypes . oneOf ( [ 'left' , 'right' ] )
16+ } ,
17+
18+ getDefaultProps : function ( ) {
19+ return {
20+ position : "left"
21+ } ;
22+ } ,
23+ _handleTouchTap : function ( ) {
24+
25+ this . setState ( {
26+ selected : true
27+ } )
28+ this . props . onTouchTap ( ) ;
29+ } ,
30+ getTheme : function ( ) {
31+ return this . context . theme . component . timePicker ;
32+ } ,
33+ render : function ( ) {
34+
35+ var {
36+ className,
37+ ...other } = this . props ;
38+
39+ var styles = {
40+ root : {
41+ position : "absolute" ,
42+ bottom : "65px" ,
43+ pointerEvents : "auto" ,
44+ height : "50px" ,
45+ width : "50px" ,
46+ borderRadius : "100%"
47+ } ,
48+
49+ label : {
50+ position : "absolute" ,
51+ top : "17px" ,
52+ left : "14px"
53+ } ,
54+
55+ select : {
56+ position : 'absolute' ,
57+ height : 50 ,
58+ width : 50 ,
59+ top : "0px" ,
60+ left : "0px" ,
61+ opacity : 0 ,
62+ borderRadius : '50%' ,
63+ transform : 'scale(0)' ,
64+ transition : Transitions . easeOut ( ) ,
65+ backgroundColor : this . getTheme ( ) . accentColor ,
66+ } ,
67+ } ;
68+
69+ if ( this . props . selected ) {
70+ styles . label . color = this . getTheme ( ) . selectTextColor ;
71+ styles . select . opacity = 1 ;
72+ styles . select . transform = 'scale(1)' ;
73+ }
74+
75+ if ( this . props . position == "right" ) {
76+ styles . root . right = "5px" ;
77+ } else {
78+ styles . root . left = "5px" ;
79+ }
80+
81+
82+
83+ return (
84+ < EnhancedButton { ...other }
85+ style = { this . mergeAndPrefix ( styles . root ) }
86+ disableFocusRipple = { true }
87+ disableTouchRipple = { true }
88+ onTouchTap = { this . _handleTouchTap } >
89+ < span style = { this . mergeAndPrefix ( styles . select ) } />
90+ < span style = { this . mergeAndPrefix ( styles . label ) } > { this . props . children } </ span >
91+ </ EnhancedButton >
92+ ) ;
93+ }
94+ } ) ;
95+
96+ module . exports = ClockButton ;
0 commit comments