11<template >
22 <div :class =" $style.container" >
3- <comment-sender v-show =" show" />
4- <button v-show =" show" :class =" $style.button" @click =" $emit('toggleDesc')" >
5- 説明
6- </button >
7- <button :class =" $style.button" @click =" $emit('toggle')" >表示/非表示</button >
3+ <input
4+ ref =" inputRef"
5+ v-model =" text"
6+ :class =" $style.input"
7+ type =" text"
8+ placeholder =" コメント"
9+ @keydown.enter =" comment"
10+ />
11+
12+ <div :class =" $style.bottomContents" >
13+ <button :class =" $style.button" @click =" $emit('toggle')" >
14+ 表示/非表示
15+ </button >
16+ <button :class =" $style.button" @click =" $emit('toggleDesc')" >説明</button >
17+ <button :class =" $style.button" @click =" comment" >送信</button >
18+ </div >
819 </div >
920</template >
1021
1122<script lang="ts">
1223import { defineComponent , computed , ref } from ' vue'
1324import { useStore } from ' /@/store'
1425import { sendComment } from ' /@/lib/connect'
15- import CommentSender from ' ./CommentSender.vue '
26+ import useShortcut from ' /@/use/shortcut '
1627
1728export default defineComponent ({
1829 name: ' BottomControls' ,
19- components: {
20- CommentSender
21- },
22- props: {
23- show: {
24- type: Boolean ,
25- required: true
26- }
27- },
2830 emits: {
2931 toggle : () => true ,
3032 toggleDesc : () => true
@@ -35,23 +37,43 @@ export default defineComponent({
3537
3638 const text = ref (' ' )
3739 const comment = () => {
40+ if (! text .value ) return
3841 sendComment ({ presentationId: presentationId .value , text: text .value })
3942 text .value = ' '
4043 }
4144
42- return { text , comment }
45+ const inputRef = ref <HTMLInputElement >()
46+ useShortcut ({ key: ' ' , ctrlKey: true }, () => {
47+ inputRef .value ?.focus ()
48+ })
49+
50+ return { text , inputRef , comment }
4351 }
4452})
4553 </script >
4654
4755<style lang="scss" module>
4856.container {
49- display : flex ;
5057 pointer-events : auto ;
51- background : rgba (255 , 255 , 255 , 0.8 );
58+ background : white ;
59+ text-align : center ;
60+ padding : 10px 5% ;
61+ }
62+ .input {
63+ width : 100% ;
64+ height : 2rem ;
65+ border-radius : 20px ;
66+ border : 2px solid #c9c1b1 ;
67+ & :focus {
68+ border-color : #fff344 ;
69+ }
70+ }
71+ .bottomContents {
72+ display : flex ;
73+ flex-direction : row ;
74+ justify-content : center ;
5275}
5376.button {
5477 margin : 0 8px ;
55- padding : 0 8px ;
5678}
5779 </style >
0 commit comments