Added new component message-item, decomposited wavelovers-app

This commit is contained in:
Eugene Serb 2022-06-30 20:15:31 +03:00
parent c66bae7371
commit e577886cdf
4 changed files with 54 additions and 32 deletions

View File

@ -24,6 +24,10 @@
<style> <style>
.device-list { .device-list {
margin-bottom: 16px;
padding: 32px;
border-radius: var(--number-border-radius);
background: var(--color-content-item-background);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-around; justify-content: space-around;

View File

@ -0,0 +1,35 @@
<template>
<div class="message">
<span>
<slot></slot>
</span>
</div>
</template>
<script>
export default {
name: 'MessageItem',
components: {},
};
</script>
<style>
.message {
width: 100%;
margin-bottom: 16px;
padding: 32px;
border-radius: var(--number-border-radius);
background: var(--color-content-item-background);
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
font-size: 16px;
}
@media only screen and (min-width: 540px) {
.message {
font-size: 24px;
}
}
</style>

View File

@ -39,6 +39,10 @@
<style> <style>
.pattern-list { .pattern-list {
margin-bottom: 16px;
padding: 32px;
border-radius: var(--number-border-radius);
background: var(--color-content-item-background);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-around; justify-content: space-around;

View File

@ -1,22 +1,14 @@
<template> <template>
<div class="wavelovers"> <div class="wavelovers">
<div class="content-item"> <PatternList v-if="patterns.length > 0"
<PatternList v-if="patterns.length > 0" :patterns="patterns"
:patterns="patterns" :mode="mode"
:mode="mode" :isActive="isActive"
:isActive="isActive" @change="change" />
@change="change" /> <MessageItem v-else>Loading...</MessageItem>
<div class="message" v-else> <GamepadList v-if="gamepads.length > 0"
<span>Loading...</span> :gamepads="gamepads" />
</div> <MessageItem v-else>Press any gamepad's button or connect new gamepad.</MessageItem>
</div>
<div class="content-item">
<GamepadList v-if="gamepads.length > 0"
:gamepads="gamepads" />
<div class="message" v-else>
<span>Press any gamepad's button or connect new gamepad.</span>
</div>
</div>
</div> </div>
</template> </template>
@ -24,12 +16,14 @@
import PatternList from '@/components/PatternList.vue'; import PatternList from '@/components/PatternList.vue';
import GamepadList from '@/components/GamepadList.vue'; import GamepadList from '@/components/GamepadList.vue';
import Gamepad from '@/components/Gamepad.js'; import Gamepad from '@/components/Gamepad.js';
import MessageItem from '@/components/MessageItem.vue';
export default { export default {
name: 'WaveloversApp', name: 'WaveloversApp',
components: { components: {
PatternList: PatternList, PatternList: PatternList,
GamepadList: GamepadList, GamepadList: GamepadList,
MessageItem: MessageItem,
}, },
data: () => { data: () => {
return { return {
@ -116,19 +110,4 @@
flex-direction: column; flex-direction: column;
} }
} }
.message {
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
text-align: center;
font-size: 16px;
}
@media only screen and (min-width: 540px) {
.message {
font-size: 24px;
}
}
</style> </style>