Skip to content

Commit 2462a4f

Browse files
committed
feat: small header portal
1 parent 0d6da5e commit 2462a4f

File tree

7 files changed

+69
-63
lines changed

7 files changed

+69
-63
lines changed

src/assets/styles/app.pcss

+8
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ a {
4444
@apply bg-gray-400 text-white;
4545
}
4646

47+
.btn-options {
48+
@apply flex items-center justify-center w-12 h-12 mx-2 rounded-full bg-gray-300 cursor-pointer;
49+
50+
&:last-child {
51+
@apply mr-0;
52+
}
53+
}
54+
4755
.no-drag {
4856
user-drag: none;
4957
user-select: none;

src/assets/styles/cardPicker.pcss

-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,3 @@
1313
.card-container {
1414
@apply w-full px-2;
1515
}
16-
17-
@screen md {
18-
.card-container {
19-
@apply w-2/5;
20-
}
21-
}

src/components/SiteHeader.vue

+8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
class="logo cursor-pointer"
66
@click="home()"
77
alt="clef.ninja Logo"
8+
title="To Home screen"
89
/>
910
<h1
1011
class="brand cursor-pointer"
1112
:class="{ 'hidden lg:block': brandHidden, visible: brandVisible }"
1213
@click="home()"
14+
title="To Home screen"
1315
>
1416
<span class="font-bold">clef</span>
1517
<span class="text-gray-800">.ninja</span>
@@ -21,6 +23,12 @@
2123
:transition="fadeTransition"
2224
@change="portalChange"
2325
/>
26+
27+
<portal-target
28+
name="header-right-small"
29+
class="flex ml-auto"
30+
:transition="fadeTransition"
31+
/>
2432
</header>
2533
</template>
2634

src/games/training/index.vue

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
<template>
22
<div class="flex flex-col flex-1 max-w-full">
3-
<portal to="header-right">
3+
<portal to="header-right-small">
44
<div class="flex items-center">
5-
<div class="btn-options" role="checkbox" @click="showSettings = true">
5+
<div
6+
class="btn-options"
7+
role="button"
8+
@click="showSettings = true"
9+
title="Settings"
10+
>
611
<SettingsIcon :size="32" fillColor="#718096" />
712
</div>
813
</div>
@@ -169,12 +174,4 @@ export default Vue.extend({
169174
max-height: 30vh;
170175
@apply flex items-center justify-center mb-8 flex-1;
171176
}
172-
173-
.btn-options {
174-
@apply flex items-center justify-center w-12 h-12 mx-2 rounded-full bg-gray-300 cursor-pointer;
175-
176-
&:last-child {
177-
@apply mr-0;
178-
}
179-
}
180177
</style>

src/views/home/__tests__/__snapshots__/HomeView.test.ts.snap

+19-28
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,25 @@ exports[`HomeView renders correctly 1`] = `
44
<div
55
class="px-4"
66
>
7+
<portal
8+
to="header-right-small"
9+
>
10+
<div
11+
class="flex items-center"
12+
>
13+
<div
14+
class="btn-options"
15+
role="button"
16+
>
17+
<settingsicon-stub
18+
fillcolor="#718096"
19+
size="32"
20+
title="Settings Outline icon"
21+
/>
22+
</div>
23+
</div>
24+
</portal>
25+
726
<h2
827
class="text-2xl"
928
>
@@ -67,34 +86,6 @@ exports[`HomeView renders correctly 1`] = `
6786
</div>
6887
</div>
6988
</div>
70-
71-
<div
72-
class="card-container"
73-
>
74-
<div
75-
class="card"
76-
>
77-
<div
78-
class="card-inner"
79-
>
80-
<settingsicon-stub
81-
fillcolor="currentColor"
82-
size="48"
83-
title="Settings Outline icon"
84-
/>
85-
86-
<h3>
87-
Settings
88-
</h3>
89-
90-
<p>
91-
92-
Setup your MIDI keyboard or pick a different instrument.
93-
94-
</p>
95-
</div>
96-
</div>
97-
</div>
9889
</div>
9990
</div>
10091
`;

src/views/home/index.vue

+13-17
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
<template>
22
<div class="px-4">
3+
<portal to="header-right-small">
4+
<div class="flex items-center">
5+
<div
6+
class="btn-options"
7+
role="button"
8+
@click="$store.commit('stage', { name: 'settingsView' })"
9+
>
10+
<SettingsIcon :size="32" fillColor="#718096" />
11+
</div>
12+
</div>
13+
</portal>
14+
315
<h2 class="text-2xl">Select your game mode.</h2>
416

517
<div class="flex justify-around py-8 flex-wrap">
@@ -27,22 +39,6 @@
2739
</div>
2840
</div>
2941
</div>
30-
31-
<div
32-
class="card-container"
33-
@click="$store.commit('stage', { name: 'settingsView' })"
34-
>
35-
<div class="card">
36-
<div class="card-inner">
37-
<SettingsIcon :size="48" />
38-
39-
<h3>Settings</h3>
40-
<p>
41-
Setup your MIDI keyboard or pick a different instrument.
42-
</p>
43-
</div>
44-
</div>
45-
</div>
4642
</div>
4743
</div>
4844
</template>
@@ -69,7 +65,7 @@ export default Vue.extend({
6965
7066
@screen md {
7167
.card-container {
72-
@apply w-1/3;
68+
@apply w-1/2;
7369
}
7470
}
7571
</style>

src/views/settings/index.vue

+14-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
<h2 class="setting-title">Input Setup</h2>
55

66
<div class="flex justify-around py-8 flex-wrap">
7-
<div class="card-container" @click="setKeyboard({ type: 'virtual' })">
7+
<div
8+
class="card-container"
9+
@click="setKeyboard({ type: 'virtual' }) || home()"
10+
>
811
<div class="card">
912
<div class="card-inner">
1013
<VirtualIcon :size="48" />
@@ -138,11 +141,14 @@ export default Vue.extend({
138141
},
139142
setInstrument(instrument: string) {
140143
this.$store.commit('instrument', instrument);
141-
this.$store.commit('stage', { name: 'homeView' });
144+
this.home();
142145
},
143146
noteUp() {
144147
this.stage = 'works';
145148
this.midi!.off('noteUp', this.noteUp);
149+
this.home();
150+
},
151+
home() {
146152
this.$store.commit('stage', { name: 'homeView' });
147153
},
148154
async startMidi() {
@@ -171,4 +177,10 @@ export default Vue.extend({
171177
@apply text-2xl;
172178
}
173179
}
180+
181+
@screen md {
182+
.card-container {
183+
@apply w-1/2;
184+
}
185+
}
174186
</style>

0 commit comments

Comments
 (0)