summaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-08-02 22:54:52 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-08-02 22:54:52 +0900
commit3f29a0382b303b371f2f63e17714eea094dd9c20 (patch)
tree015067ebea9b674294037cf3647fc2f1f92ad698 /src/client
parentRefactoring (diff)
downloadmisskey-3f29a0382b303b371f2f63e17714eea094dd9c20.tar.gz
misskey-3f29a0382b303b371f2f63e17714eea094dd9c20.tar.bz2
misskey-3f29a0382b303b371f2f63e17714eea094dd9c20.zip
wip
Diffstat (limited to 'src/client')
-rw-r--r--src/client/app/common/views/components/games/reversi/reversi.room.vue133
-rw-r--r--src/client/app/common/views/components/games/reversi/reversi.vue2
-rw-r--r--src/client/app/common/views/components/index.ts2
-rw-r--r--src/client/app/common/views/components/ui/form/button.vue79
4 files changed, 160 insertions, 56 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 94b36d0870..f04d8d0873 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
@@ -5,8 +5,8 @@
<div>
<p>%i18n:@settings-of-the-game%</p>
- <el-card class="map">
- <div slot="header">
+ <div class="card">
+ <header>
<el-select :class="$style.mapSelect" v-model="mapName" placeholder="%i18n:@choose-map%" @change="onMapChange">
<el-option label="%i18n:@random%" :value="null"/>
<el-option-group v-for="c in mapCategories" :key="c" :label="c">
@@ -16,63 +16,80 @@
</el-option>
</el-option-group>
</el-select>
- </div>
- <div :class="$style.board" v-if="game.settings.map != null" :style="{ 'grid-template-rows': `repeat(${ game.settings.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.settings.map[0].length }, 1fr)` }">
- <div v-for="(x, i) in game.settings.map.join('')"
- :data-none="x == ' '"
- @click="onPixelClick(i, x)"
- >
- <template v-if="x == 'b'">%fa:circle%</template>
- <template v-if="x == 'w'">%fa:circle R%</template>
+ </header>
+
+ <div>
+ <div :class="$style.board" v-if="game.settings.map != null" :style="{ 'grid-template-rows': `repeat(${ game.settings.map.length }, 1fr)`, 'grid-template-columns': `repeat(${ game.settings.map[0].length }, 1fr)` }">
+ <div v-for="(x, i) in game.settings.map.join('')"
+ :data-none="x == ' '"
+ @click="onPixelClick(i, x)">
+ <template v-if="x == 'b'">%fa:circle%</template>
+ <template v-if="x == 'w'">%fa:circle R%</template>
+ </div>
</div>
</div>
- </el-card>
+ </div>
- <el-card class="bw">
- <div slot="header">
+ <div class="card">
+ <header>
<span>%i18n:@black-or-white%</span>
+ </header>
+
+ <div>
+ <el-radio v-model="game.settings.bw" label="random" @change="updateSettings">%i18n:@random%</el-radio>
+ <el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user1 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
+ <el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user2 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
</div>
- <el-radio v-model="game.settings.bw" label="random" @change="updateSettings">%i18n:@random%</el-radio>
- <el-radio v-model="game.settings.bw" :label="1" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user1 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
- <el-radio v-model="game.settings.bw" :label="2" @change="updateSettings">{{ '%i18n:@black-is%'.split('{}')[0] }}{{ game.user2 | userName }}{{ '%i18n:@black-is%'.split('{}')[1] }}</el-radio>
- </el-card>
+ </div>
- <el-card class="rules">
- <div slot="header">
+ <div class="card">
+ <header>
<span>%i18n:@rules%</span>
+ </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%"/>
</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%"/>
- </el-card>
+ </div>
- <el-card class="bot-form" v-if="form">
- <div slot="header">
+ <div class="card" v-if="form">
+ <header>
<span>%i18n:@settings-of-the-bot%</span>
- </div>
- <el-alert v-for="message in messages"
- :title="message.text"
- :type="message.type"
- :key="message.id"
- />
- <template v-for="item in form">
- <mk-switch v-if="item.type == 'button'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
+ </header>
+
+ <div>
+ <el-alert v-for="message in messages"
+ :title="message.text"
+ :type="message.type"
+ :key="message.id"/>
+
+ <template v-for="item in form">
+ <mk-switch v-if="item.type == 'button'" v-model="item.value" :key="item.id" :text="item.label" @change="onChangeForm($event, item)">{{ item.desc || '' }}</mk-switch>
- <el-card v-if="item.type == 'radio'" :key="item.id">
- <div slot="header">
- <span>{{ item.label }}</span>
+ <div class="card" v-if="item.type == 'radio'" :key="item.id">
+ <header>
+ <span>{{ item.label }}</span>
+ </header>
+
+ <div>
+ <el-radio v-for="(r, i) in item.items" :key="item.id + ':' + i" v-model="item.value" :label="r.value" @change="onChangeForm($event, item)">{{ r.label }}</el-radio>
+ </div>
</div>
- <el-radio v-for="(r, i) in item.items" :key="item.id + ':' + i" v-model="item.value" :label="r.value" @change="onChangeForm($event, item)">{{ r.label }}</el-radio>
- </el-card>
- <el-card v-if="item.type == 'textbox'" :key="item.id">
- <div slot="header">
- <span>{{ item.label }}</span>
+ <div class="card" v-if="item.type == 'textbox'" :key="item.id">
+ <header>
+ <span>{{ item.label }}</span>
+ </header>
+
+ <div>
+ <el-input v-model="item.value" @change="onChangeForm($event, item)"/>
+ </div>
</div>
- <el-input v-model="item.value" @change="onChangeForm($event, item)"/>
- </el-card>
- </template>
- </el-card>
+ </template>
+ </div>
+ </div>
</div>
<footer>
@@ -244,13 +261,24 @@ export default Vue.extend({
> div
padding 0 16px
- > .map
- > .bw
- > .rules
- > .bot-form
- max-width 400px
+ > .card
margin 0 auto 16px auto
+ .card
+ max-width 400px
+ border-radius 4px
+ border 1px solid #ebeef5
+ background #fff
+ color #303133
+ box-shadow 0 2px 12px 0 rgba(#000, 0.1)
+
+ > header
+ padding 18px 20px
+ border-bottom 1px solid #ebeef5
+
+ > div
+ padding 20px
+
> footer
position sticky
bottom 0
@@ -290,8 +318,3 @@ export default Vue.extend({
border-color transparent
</style>
-
-<style lang="stylus">
-.el-alert__content
- position initial !important
-</style>
diff --git a/src/client/app/common/views/components/games/reversi/reversi.vue b/src/client/app/common/views/components/games/reversi/reversi.vue
index 43f1c6656a..e3a62ff627 100644
--- a/src/client/app/common/views/components/games/reversi/reversi.vue
+++ b/src/client/app/common/views/components/games/reversi/reversi.vue
@@ -14,7 +14,7 @@
<p>%i18n:@sub-title%</p>
<div class="play">
<!--<el-button round>フリーマッチ(準備中)</el-button>-->
- <el-button type="primary" round @click="match">%i18n:@invite%</el-button>
+ <form-button primary round @click="match">%i18n:@invite%</form-button>
<details>
<summary>%i18n:@rule%</summary>
<div>
diff --git a/src/client/app/common/views/components/index.ts b/src/client/app/common/views/components/index.ts
index c18a1c3b68..7075a8fc0b 100644
--- a/src/client/app/common/views/components/index.ts
+++ b/src/client/app/common/views/components/index.ts
@@ -37,6 +37,7 @@ import uiTextarea from './ui/textarea.vue';
import uiSwitch from './ui/switch.vue';
import uiRadio from './ui/radio.vue';
import uiSelect from './ui/select.vue';
+import formButton from './ui/form/button.vue';
Vue.component('mk-analog-clock', analogClock);
Vue.component('mk-menu', menu);
@@ -75,3 +76,4 @@ Vue.component('ui-textarea', uiTextarea);
Vue.component('ui-switch', uiSwitch);
Vue.component('ui-radio', uiRadio);
Vue.component('ui-select', uiSelect);
+Vue.component('form-button', formButton);
diff --git a/src/client/app/common/views/components/ui/form/button.vue b/src/client/app/common/views/components/ui/form/button.vue
new file mode 100644
index 0000000000..a9d9dfef27
--- /dev/null
+++ b/src/client/app/common/views/components/ui/form/button.vue
@@ -0,0 +1,79 @@
+<template>
+<div class="nvemkhtwcnnpkdrwfcbzuwhfulejhmzg" :class="{ round, primary }">
+ <button :type="type" @click="$emit('click')">
+ <slot></slot>
+ </button>
+</div>
+</template>
+
+<script lang="ts">
+import Vue from 'vue';
+export default Vue.extend({
+ props: {
+ round: {
+ type: Boolean,
+ required: false,
+ default: false
+ },
+ primary: {
+ type: Boolean,
+ required: false,
+ default: false
+ }
+ }
+});
+</script>
+
+<style lang="stylus" scoped>
+@import '~const.styl'
+
+root(isDark)
+ > button
+ display inline-block
+ margin 0
+ padding 12px 20px
+ font-size 14px
+ border 1px solid #dcdfe6
+ border-radius 4px
+ outline none
+ box-shadow none
+ color #606266
+ transition 0.1s
+
+ &:hover
+ &:focus
+ color $theme-color
+ background rgba($theme-color, 0.12)
+ border-color rgba($theme-color, 0.3)
+
+ &:active
+ color darken($theme-color, 20%)
+ background rgba($theme-color, 0.12)
+ border-color $theme-color
+ transition all 0s
+
+ &.primary
+ > button
+ border none
+ background $theme-color
+ color $theme-color-foreground
+
+ &:hover
+ &:focus
+ background lighten($theme-color, 20%)
+
+ &:active
+ background darken($theme-color, 20%)
+ transition all 0s
+
+ &.round
+ > button
+ border-radius 64px
+
+.nvemkhtwcnnpkdrwfcbzuwhfulejhmzg[data-darkmode]
+ root(true)
+
+.nvemkhtwcnnpkdrwfcbzuwhfulejhmzg:not([data-darkmode])
+ root(false)
+
+</style>