Skip to content

Commit a71bf81

Browse files
committed
feat: hide buttons
1 parent 19659ab commit a71bf81

File tree

2 files changed

+35
-22
lines changed

2 files changed

+35
-22
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ directive is required.
132132
| `help-text` | Command help | `String` | `''` | No | Yes |
133133
| `help-timeout` | Command help timeout | `Number` | `3000` | No | No |
134134
| `hide-bar` | Hides the bar | `Boolean` | `false` | No | No |
135+
| `hide-buttons` | Hides the buttons | `Boolean` | `false` | No | No |
135136
| `hide-prompt` | Hides the prompt | `Boolean` | `false` | No | No |
136137
| `hide-title` | Hides the title | `Boolean` | `false` | No | No |
137138
| `history` | Terminal history | `Array` | `[]` | No | Yes |
@@ -201,7 +202,8 @@ classes. Example:
201202

202203
### Buttons
203204

204-
Inside the bar, you can customize the buttons. Example:
205+
Inside the bar, you can customize the buttons. If you use this slot,
206+
`hideButtons` property has no effect. Example:
205207

206208
```vue
207209
<vue-command>

src/components/VueCommand.vue

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
'vue-command--invert': invert
77
}">
88
<!-- Bar -->
9-
<slot name="bar">
9+
<slot
10+
v-if="!hideBar"
11+
name="bar">
1012
<div
11-
v-if="!hideBar"
1213
:class="{
1314
'vue-command__bar': !invert,
1415
'vue-command__bar--invert': invert
1516
}">
1617
<div>
17-
<slot name="buttons">
18+
<slot
19+
v-if="!hideButtons"
20+
name="buttons">
1821
<span
1922
:class="{
2023
'vue-command__bar__button': !invert,
@@ -42,16 +45,17 @@
4245
</slot>
4346
</div>
4447
<div>
45-
<slot name="title">
48+
<slot
49+
v-if="!hideTitle"
50+
name="title">
4651
<span
47-
v-if="!hideTitle"
4852
:class="{
4953
'vue-command__bar__title': !invert,
5054
'vue-command__bar__title--invert': invert
5155
}">{{ title }}</span>
5256
</slot>
5357
</div>
54-
<div />
58+
<div>&#8203;</div>
5559
</div>
5660
</slot>
5761

@@ -179,6 +183,12 @@ const props = defineProps({
179183
type: Boolean
180184
},
181185
186+
hideButtons: {
187+
default: false,
188+
required: false,
189+
type: Boolean
190+
},
191+
182192
hidePrompt: {
183193
default: false,
184194
required: false,
@@ -583,20 +593,21 @@ defineExpose({
583593
}
584594
}
585595
586-
overflow-y: hidden;
587596
overflow-x: hidden;
597+
overflow-y: hidden;
588598
589599
.vue-command__bar,
590600
.vue-command__bar--invert {
591601
@include clearfix();
592-
position: inherit;
602+
603+
display: flex;
604+
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
605+
justify-content: space-between;
606+
padding-bottom: 10px;
593607
padding-left: 10px;
594608
padding-right: 10px;
595609
padding-top: 10px;
596-
padding-bottom: 10px;
597-
display: flex;
598-
justify-content: space-between;
599-
font-family: -apple-system, BlinkMacSystemFont, sans-serif;
610+
position: inherit;
600611
}
601612
602613
.vue-command__bar__button,
@@ -618,32 +629,32 @@ defineExpose({
618629
619630
.vue-command__history--invert,
620631
.vue-command__history {
621-
overflow: auto;
622-
word-break: break-all;
623632
display: block;
624-
padding: 12px 12px 12px 12px;
633+
height: 100%;
634+
line-height: 1.33;
625635
margin: 0;
636+
overflow: auto;
637+
padding: 12px 12px 12px 12px;
626638
white-space: pre-line;
627-
line-height: 1.33;
628-
height: 100%;
639+
word-break: break-all;
629640
630641
/* Provide reasonable default values */
631642
ul {
643+
list-style-type: none;
632644
margin: 0;
633645
padding: 0;
634-
list-style-type: none;
635646
}
636647
637648
input,
638649
textarea {
639650
background: none;
640651
border: none;
641-
outline: none;
642652
flex: 1;
643653
font-size: 1rem;
644-
width: 100%;
645-
resize: none;
654+
outline: none;
646655
overflow: hidden;
656+
resize: none;
657+
width: 100%;
647658
}
648659
}
649660

0 commit comments

Comments
 (0)