summaryrefslogtreecommitdiff
path: root/src/client/app/common
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-09-27 12:55:10 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-09-27 12:55:10 +0900
commitdf6c9b1a1cf7b4ff8cdbf562e004bbf3635d841b (patch)
treeaabef6c3c1ab620672388ba01b80ca5f7b9e4e39 /src/client/app/common
parentwip (diff)
downloadsharkey-df6c9b1a1cf7b4ff8cdbf562e004bbf3635d841b.tar.gz
sharkey-df6c9b1a1cf7b4ff8cdbf562e004bbf3635d841b.tar.bz2
sharkey-df6c9b1a1cf7b4ff8cdbf562e004bbf3635d841b.zip
wip
Diffstat (limited to 'src/client/app/common')
-rw-r--r--src/client/app/common/views/components/games/reversi/reversi.room.vue6
-rw-r--r--src/client/app/common/views/components/index.ts2
-rw-r--r--src/client/app/common/views/components/switch.vue199
-rw-r--r--src/client/app/common/views/components/ui/button.vue2
-rw-r--r--src/client/app/common/views/components/ui/switch.vue17
5 files changed, 7 insertions, 219 deletions
diff --git a/src/client/app/common/views/components/games/reversi/reversi.room.vue b/src/client/app/common/views/components/games/reversi/reversi.room.vue
index 072f3eda12..b407046ba9 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.room.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.room.vue
@@ -47,9 +47,9 @@
</header>
<div>
- <mk-switch v-model="game.settings.isLlotheo" @change="updateSettings" text="%i18n:@is-llotheo%"/>
- <mk-switch v-model="game.settings.loopedBoard" @change="updateSettings" text="%i18n:@looped-map%"/>
- <mk-switch v-model="game.settings.canPutEverywhere" @change="updateSettings" text="%i18n:@can-put-everywhere%"/>
+ <ui-switch v-model="game.settings.isLlotheo" @change="updateSettings">%i18n:@is-llotheo%</ui-switch>
+ <ui-switch v-model="game.settings.loopedBoard" @change="updateSettings">%i18n:@looped-map%</ui-switch>
+ <ui-switch v-model="game.settings.canPutEverywhere" @change="updateSettings">%i18n:@can-put-everywhere%</ui-switch>
</div>
</div>
diff --git a/src/client/app/common/views/components/index.ts b/src/client/app/common/views/components/index.ts
index 0a3d0d0ae6..4c1c0afa80 100644
--- a/src/client/app/common/views/components/index.ts
+++ b/src/client/app/common/views/components/index.ts
@@ -30,7 +30,6 @@ import messagingRoom from './messaging-room.vue';
import urlPreview from './url-preview.vue';
import twitterSetting from './twitter-setting.vue';
import fileTypeIcon from './file-type-icon.vue';
-import Switch from './switch.vue';
import Reversi from './games/reversi/reversi.vue';
import welcomeTimeline from './welcome-timeline.vue';
import uiInput from './ui/input.vue';
@@ -74,7 +73,6 @@ Vue.component('mk-messaging-room', messagingRoom);
Vue.component('mk-url-preview', urlPreview);
Vue.component('mk-twitter-setting', twitterSetting);
Vue.component('mk-file-type-icon', fileTypeIcon);
-Vue.component('mk-switch', Switch);
Vue.component('mk-reversi', Reversi);
Vue.component('mk-welcome-timeline', welcomeTimeline);
Vue.component('ui-input', uiInput);
diff --git a/src/client/app/common/views/components/switch.vue b/src/client/app/common/views/components/switch.vue
deleted file mode 100644
index aa60331cbc..0000000000
--- a/src/client/app/common/views/components/switch.vue
+++ /dev/null
@@ -1,199 +0,0 @@
-<template>
-<div
- class="mk-switch"
- :class="{ disabled, checked }"
- role="switch"
- :aria-checked="checked"
- :aria-disabled="disabled"
- @click="switchValue"
- @mouseover="mouseenter"
->
- <input
- type="checkbox"
- @change="handleChange"
- ref="input"
- :disabled="disabled"
- @keydown.enter="switchValue"
- >
- <span class="button">
- <span :style="{ transform }"></span>
- </span>
- <span class="label">
- <span :aria-hidden="!checked">{{ text }}</span>
- <p :aria-hidden="!checked">
- <slot></slot>
- </p>
- </span>
-</div>
-</template>
-
-<script lang="ts">
-import Vue from 'vue';
-export default Vue.extend({
- props: {
- value: {
- type: Boolean,
- default: false
- },
- disabled: {
- type: Boolean,
- default: false
- },
- text: String
- },/*
- created() {
- if (!~[true, false].indexOf(this.value)) {
- this.$emit('input', false);
- }
- },*/
- computed: {
- checked(): boolean {
- return this.value;
- },
- transform(): string {
- return this.checked ? 'translate3d(20px, 0, 0)' : '';
- }
- },
- watch: {
- value() {
- (this.$el).style.transition = 'all 0.3s';
- (this.$refs.input as any).checked = this.checked;
- }
- },
- mounted() {
- (this.$refs.input as any).checked = this.checked;
- },
- methods: {
- mouseenter() {
- (this.$el).style.transition = 'all 0s';
- },
- handleChange() {
- (this.$el).style.transition = 'all 0.3s';
- this.$emit('input', !this.checked);
- this.$emit('change', !this.checked);
- this.$nextTick(() => {
- // set input's checked property
- // in case parent refuses to change component's value
- (this.$refs.input as any).checked = this.checked;
- });
- },
- switchValue() {
- !this.disabled && this.handleChange();
- }
- }
-});
-</script>
-
-<style lang="stylus" scoped>
-
-
-root(isDark)
- display flex
- margin 12px 0
- cursor pointer
- transition all 0.3s
-
- > *
- user-select none
-
- &.disabled
- opacity 0.6
- cursor not-allowed
-
- &.checked
- > .button
- background-color var(--primary)
- border-color var(--primary)
-
- > .label
- > span
- color var(--primary)
-
- &:hover
- > .label
- > span
- color var(--primaryDarken10)
-
- > .button
- background var(--primaryDarken10)
- border-color var(--primaryDarken10)
-
- &:hover
- > .label
- > span
- color isDark ? #fff : #2e3338
-
- > .button
- $color = isDark ? #15181d : #ced2da
- background $color
- border-color $color
-
- > input
- position absolute
- width 0
- height 0
- opacity 0
- margin 0
-
- &:focus + .button
- &:after
- content ""
- pointer-events none
- position absolute
- top -5px
- right -5px
- bottom -5px
- left -5px
- border 2px solid var(--primaryAlpha03)
- border-radius 14px
-
- > .button
- $color = isDark ? #1c1f25 : #dcdfe6
-
- display inline-block
- margin 0
- width 40px
- min-width 40px
- height 20px
- min-height 20px
- background $color
- border 1px solid $color
- outline none
- border-radius 10px
- transition inherit
-
- > *
- position absolute
- top 1px
- left 1px
- border-radius 100%
- transition transform 0.3s
- width 16px
- height 16px
- background-color #fff
-
- > .label
- margin-left 8px
- display block
- font-size 15px
- cursor pointer
- transition inherit
-
- > span
- display block
- line-height 20px
- color isDark ? #c4ccd2 : #4a535a
- transition inherit
-
- > p
- margin 0
- //font-size 90%
- color isDark ? #78858e : #9daab3
-
-.mk-switch[data-darkmode]
- root(true)
-
-.mk-switch:not([data-darkmode])
- root(false)
-
-</style>
diff --git a/src/client/app/common/views/components/ui/button.vue b/src/client/app/common/views/components/ui/button.vue
index ae59214038..c411f0f5c9 100644
--- a/src/client/app/common/views/components/ui/button.vue
+++ b/src/client/app/common/views/components/ui/button.vue
@@ -32,8 +32,6 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
-
-
root(isDark, fill)
> button
display block
diff --git a/src/client/app/common/views/components/ui/switch.vue b/src/client/app/common/views/components/ui/switch.vue
index e358713d8f..2ee787cb76 100644
--- a/src/client/app/common/views/components/ui/switch.vue
+++ b/src/client/app/common/views/components/ui/switch.vue
@@ -56,9 +56,7 @@ export default Vue.extend({
</script>
<style lang="stylus" scoped>
-
-
-root(isDark)
+.ui-switch
display flex
margin 32px 0
cursor pointer
@@ -99,7 +97,7 @@ root(isDark)
margin 3px 0 0 0
width 34px
height 14px
- background isDark ? rgba(#fff, 0.15) : rgba(#000, 0.25)
+ background var(--switchTrack)
outline none
border-radius 14px
transition inherit
@@ -125,18 +123,11 @@ root(isDark)
> span
display block
line-height 20px
- color isDark ? #c4ccd2 : rgba(#000, 0.75)
+ color currentColor
transition inherit
> p
margin 0
- //font-size 90%
- color isDark ? #78858e : #9daab3
-
-.ui-switch[data-darkmode]
- root(true)
-
-.ui-switch:not([data-darkmode])
- root(false)
+ opacity 0.7
</style>