diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-15 02:54:42 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-15 02:54:42 +0900 |
| commit | 87451b1223693247eea956e4af24728db7fb97e1 (patch) | |
| tree | a23a79a3bc41950f75720ac254e98e36b2482a6f /src/client/components | |
| parent | Improve usability (diff) | |
| download | misskey-87451b1223693247eea956e4af24728db7fb97e1.tar.gz misskey-87451b1223693247eea956e4af24728db7fb97e1.tar.bz2 misskey-87451b1223693247eea956e4af24728db7fb97e1.zip | |
Add header clock
Diffstat (limited to 'src/client/components')
| -rw-r--r-- | src/client/components/header-clock.vue | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/client/components/header-clock.vue b/src/client/components/header-clock.vue new file mode 100644 index 0000000000..e011063bf9 --- /dev/null +++ b/src/client/components/header-clock.vue @@ -0,0 +1,100 @@ +<template> +<div class="eqryymyo"> + <div class="header"> + <time ref="time" class="_ghost"> + <span class="yyyymmdd">{{ yyyy }}/{{ mm }}/{{ dd }}</span> + <br> + <span class="hhnn">{{ hh }}<span :style="{ visibility: now.getSeconds() % 2 == 0 ? 'visible' : 'hidden' }">:</span>{{ nn }}</span> + </time> + </div> + <div class="content _panel"> + <mk-clock/> + </div> +</div> +</template> + +<script lang="ts"> +import Vue from 'vue'; +import MkClock from './analog-clock.vue'; + +export default Vue.extend({ + components: { + MkClock + }, + data() { + return { + now: new Date(), + clock: null + }; + }, + computed: { + yyyy(): number { + return this.now.getFullYear(); + }, + mm(): string { + return ('0' + (this.now.getMonth() + 1)).slice(-2); + }, + dd(): string { + return ('0' + this.now.getDate()).slice(-2); + }, + hh(): string { + return ('0' + this.now.getHours()).slice(-2); + }, + nn(): string { + return ('0' + this.now.getMinutes()).slice(-2); + } + }, + mounted() { + this.tick(); + this.clock = setInterval(this.tick, 1000); + }, + beforeDestroy() { + clearInterval(this.clock); + }, + methods: { + tick() { + this.now = new Date(); + } + } +}); +</script> + +<style lang="scss" scoped> +.eqryymyo { + display: inline-block; + overflow: visible; + + > .header { + padding: 0 12px; + text-align: center; + font-size: 12px; + + &:hover + .content { + opacity: 1; + } + + > time { + display: table-cell; + vertical-align: middle; + height: 48px; + + > .yyyymmdd { + opacity: 0.7; + } + } + } + + > .content { + opacity: 0; + display: block; + position: absolute; + top: auto; + right: 0; + z-index: 3; + margin: 16px 0 0 0; + padding: 16px; + width: 230px; + transition: opacity 0.2s ease; + } +} +</style> |