Refactored Terminal
parent
3d3c90c2e5
commit
68960d68c6
|
@ -1,16 +1,16 @@
|
|||
<template>
|
||||
<div :class="cx('root')" @click="onClick" v-bind="ptmi('root')">
|
||||
<div v-if="welcomeMessage" v-bind="ptm('welcomeMessage')">{{ welcomeMessage }}</div>
|
||||
<div :class="cx('content')" v-bind="ptm('content')">
|
||||
<div v-for="(command, i) of commands" :key="command.text + i.toString()" v-bind="ptm('commands')">
|
||||
<span :class="cx('prompt')" v-bind="ptm('prompt')">{{ prompt }}</span>
|
||||
<span :class="cx('command')" v-bind="ptm('command')">{{ command.text }}</span>
|
||||
<div :class="cx('response')" aria-live="polite" v-bind="ptm('response')">{{ command.response }}</div>
|
||||
<div v-if="welcomeMessage" :class="cx('welcomeMessage')" v-bind="ptm('welcomeMessage')">{{ welcomeMessage }}</div>
|
||||
<div :class="cx('commandList')" v-bind="ptm('content')">
|
||||
<div v-for="(command, i) of commands" :key="command.text + i.toString()" :class="cx('command')" v-bind="ptm('commands')">
|
||||
<span :class="cx('promptLabel')" v-bind="ptm('prompt')">{{ prompt }}</span>
|
||||
<span :class="cx('commandValue')" v-bind="ptm('command')">{{ command.text }}</span>
|
||||
<div :class="cx('commandResponse')" aria-live="polite" v-bind="ptm('response')">{{ command.response }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="cx('container')" v-bind="ptm('container')">
|
||||
<span :class="cx('prompt')" v-bind="ptm('prompt')">{{ prompt }}</span>
|
||||
<input ref="input" v-model="commandText" type="text" :class="cx('commandText')" autocomplete="off" @keydown="onKeydown" v-bind="ptm('commandText')" />
|
||||
<div :class="cx('prompt')" v-bind="ptm('container')">
|
||||
<span :class="cx('promptLabel')" v-bind="ptm('prompt')">{{ prompt }}</span>
|
||||
<input ref="input" v-model="commandText" :class="cx('promptValue')" type="text" autocomplete="off" @keydown="onKeydown" v-bind="ptm('commandText')" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -2,12 +2,14 @@ import BaseStyle from 'primevue/base/style';
|
|||
|
||||
const classes = {
|
||||
root: 'p-terminal p-component',
|
||||
content: 'p-terminal-commands-container',
|
||||
welcomeMessage: 'p-terminal-welcome-message',
|
||||
commandList: 'p-terminal-command-list',
|
||||
command: 'p-terminal-command',
|
||||
commandValue: 'p-terminal-command-value',
|
||||
commandResponse: 'p-terminal-command-response',
|
||||
prompt: 'p-terminal-prompt',
|
||||
command: 'p-terminal-command-value',
|
||||
response: 'p-terminal-command-response',
|
||||
container: 'p-terminal-prompt-container',
|
||||
commandText: 'p-terminal-input'
|
||||
promptLabel: 'p-terminal-prompt-label',
|
||||
promptValue: 'p-terminal-prompt-value'
|
||||
};
|
||||
|
||||
export default BaseStyle.extend({
|
||||
|
|
|
@ -10,12 +10,12 @@ export default {
|
|||
border-radius: ${dt('rounded.base')};
|
||||
}
|
||||
|
||||
.p-terminal-prompt-container {
|
||||
.p-terminal-prompt {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.p-terminal-input {
|
||||
.p-terminal-prompt-value {
|
||||
flex: 1 1 auto;
|
||||
border: 0 none;
|
||||
background-color: transparent;
|
||||
|
@ -27,7 +27,7 @@ export default {
|
|||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.p-terminal-prompt {
|
||||
.p-terminal-prompt-label {
|
||||
margin-right: 0.25rem;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue