This repository was archived by the owner on Aug 27, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +59
-7
lines changed
imports/materialdesign/components/TimePicker Expand file tree Collapse file tree 3 files changed +59
-7
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,26 @@ export default class TimePicker extends Component {
219219 if ( tick != null ) tick . getRoot ( ) . classList . remove ( 'selected' )
220220 }
221221
222+ /**
223+ * On confirm button click.
224+ * Triggers event.
225+ * @param {Event }
226+ */
227+ onConfirmButtonClick = ( e ) => {
228+ const onConfirm = this . props . onConfirm
229+
230+ if ( typeof onConfirm === 'function' ) {
231+ /**
232+ * @param {Int } hour
233+ * @param {Int | String } minutes
234+ * @param {Boolean } is AM
235+ */
236+ onConfirm ( this . elements . hoursClock . selectedTick . props . number , this . elements . minutesClock . selectedTick . props . number , this . isAM )
237+ }
238+
239+ this . toggle ( false )
240+ }
241+
222242 render ( ) {
223243 return (
224244 < div >
@@ -275,7 +295,7 @@ export default class TimePicker extends Component {
275295
276296 const buttons = (
277297 < div >
278- < MaterialButton text = 'OK' shadow = { false } rippleStyle = { this . props . actionButtonRippleStyle } />
298+ < MaterialButton text = 'OK' shadow = { false } rippleStyle = { this . props . actionButtonRippleStyle } onClick = { this . onConfirmButtonClick } />
279299 < MaterialButton text = 'ANULUJ' shadow = { false } rippleStyle = { this . props . actionButtonRippleStyle } onClick = { ( ) => { this . toggle ( false ) } } />
280300 </ div >
281301 )
Original file line number Diff line number Diff line change 1010 display : none ;
1111 opacity : 0 ;
1212 top : 25% ;
13+ border-radius : 2px ;
14+ background-color : #fff ;
1315
1416 & .date-display {
1517 width : 196px ;
1618 height : 100% ;
1719 background-color : #26a69a ;
18- position : relative ;
19- float : left ;
20+ position : absolute ;
21+ left : 0 ;
22+ top : 0 ;
2023
2124 & .date-container {
2225 color : rgba (255 , 255 , 255 , 0.54 );
4447
4548 & .am-pm-container {
4649 padding-top : 8px ;
47- font-size : 18 px ;
50+ font-size : 17 px ;
4851 margin : 0 auto ;
4952 text-align : center ;
5053
6669 & .clock-buttons-container {
6770 width : calc (100% - 196px );
6871 height : 100% ;
69- position : relative ;
70- float : left ;
72+ position : absolute ;
73+ right : 0 ;
74+ top : 0 ;
7175 background-color : #fff ;
7276
7377 & .clock {
153157 }
154158
155159 & ::after {
160+ content : ' ' ;
161+ display : block ;
156162 clear : both ;
157163 }
158164 }
172178 }
173179
174180 & ::after {
181+ content : ' ' ;
182+ display : block ;
175183 clear : both ;
176184 }
177185}
187195 z-index : 8 ;
188196 transition : 0.3s opacity ;
189197}
198+
199+ @media (max-width : 624px ) {
200+ .material-time-picker {
201+ width : 356px ;
202+ height : 464px ;
203+
204+ & .date-display {
205+ width : 100% ;
206+ height : 90px ;
207+
208+ & .am-pm-container {
209+ position : absolute ;
210+ top : 0 ;
211+ right : -38px ;
212+ }
213+ }
214+
215+ & .clock-buttons-container {
216+ width : 100% ;
217+ height : calc (100% - 88px );
218+ top : 88px ;
219+ }
220+ }
221+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ export default class App extends Component {
1111 return (
1212 < div >
1313 < div className = 'app-content' ref = 'appContent' >
14- < TimePicker />
14+ < TimePicker onConfirm = { ( hour , minutes , isAM ) => { console . log ( hour + ':' + minutes + ' (' + ( ( isAM ) ? 'AM' : 'PM' ) + ')' ) } } />
1515 </ div >
1616 </ div >
1717 )
You can’t perform that action at this time.
0 commit comments