Skip to content

Commit 1ed7a9f

Browse files
committed
Adding seconds for clock
1 parent 463c1a8 commit 1ed7a9f

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

public/app.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ body {
2525
border: .3rem solid #fff;
2626
border-radius: .5rem;
2727
display: inline-block;
28+
margin-bottom: 1em;
2829
}
2930

3031
.clock__hours,
31-
.clock__minutes {
32+
.clock__minutes,
33+
.clock__seconds {
3234
background: linear-gradient(to bottom, #26303b 50%, #2c3540 50%);
3335
display: inline-block;
3436
color: #fff;
@@ -46,6 +48,10 @@ body {
4648
}
4749

4850
.clock__minutes {
51+
border-right: .15rem solid #fff;
52+
}
53+
54+
.clock__seconds {
4955
border-radius: 0 .5rem .5rem 0;
5056
}
5157

public/app.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7421,11 +7421,12 @@ function getZeroPad (n) {
74217421
return (parseInt(n, 10) >= 10 ? '' : '0') + n
74227422
}
74237423

7424-
var Clock = {render: function(){with(this){return _h('div',{staticClass:"clock"},[_h('div',{staticClass:"clock__hours"},[_h('span',{staticClass:"clock__hourtime"},[_s(hourtime)])," "+_s(hours)]),_h('div',{staticClass:"clock__minutes"},[_s(minutes)])])}},staticRenderFns: [],
7424+
var Clock = {render: function(){with(this){return _h('div',{staticClass:"clock"},[_h('div',{staticClass:"clock__hours"},[_h('span',{staticClass:"clock__hourtime"},[_s(hourtime)])," "+_s(hours)]),_h('div',{staticClass:"clock__minutes"},[_s(minutes)]),_h('div',{staticClass:"clock__seconds"},[_s(seconds)])])}},staticRenderFns: [],
74257425
data: function data () {
74267426
return {
74277427
hours: '',
74287428
minutes: '',
7429+
seconds: '',
74297430
hourtime: ''
74307431
}
74317432
},
@@ -7439,6 +7440,7 @@ var Clock = {render: function(){with(this){return _h('div',{staticClass:"clock"}
74397440

74407441
self.hours = now.getHours()
74417442
self.minutes = getZeroPad(now.getMinutes())
7443+
self.seconds = getZeroPad(now.getSeconds())
74427444
self.hourtime = getHourTime(self.hours)
74437445
self.hours = self.hours % 12 || 12
74447446

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<div class="container">
1111
<div id="app">
1212
<Clock></Clock>
13-
<Clock></Clock>
1413
</div>
1514
</div>
1615
</div>
16+
<script src="https://unpkg.com/[email protected]"></script>
1717
<script src="app.js"></script>
1818
</body>
1919
</html>

src/components/Clock.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{{hours}}
66
</div>
77
<div class="clock__minutes">{{minutes}}</div>
8+
<div class="clock__seconds">{{seconds}}</div>
89
</div>
910
</template>
1011

@@ -16,6 +17,7 @@ export default {
1617
return {
1718
hours: '',
1819
minutes: '',
20+
seconds: '',
1921
hourtime: ''
2022
}
2123
},
@@ -29,6 +31,7 @@ export default {
2931
3032
self.hours = now.getHours()
3133
self.minutes = getZeroPad(now.getMinutes())
34+
self.seconds = getZeroPad(now.getSeconds())
3235
self.hourtime = getHourTime(self.hours)
3336
self.hours = self.hours % 12 || 12
3437
@@ -65,10 +68,12 @@ body {
6568
border: .3rem solid #fff;
6669
border-radius: .5rem;
6770
display: inline-block;
71+
margin-bottom: 1em;
6872
}
6973
7074
.clock__hours,
71-
.clock__minutes {
75+
.clock__minutes,
76+
.clock__seconds {
7277
background: linear-gradient(to bottom, #26303b 50%, #2c3540 50%);
7378
display: inline-block;
7479
color: #fff;
@@ -86,6 +91,10 @@ body {
8691
}
8792
8893
.clock__minutes {
94+
border-right: .15rem solid #fff;
95+
}
96+
97+
.clock__seconds {
8998
border-radius: 0 .5rem .5rem 0;
9099
}
91100

0 commit comments

Comments
 (0)