Skip to content

Commit 075b083

Browse files
committed
[#47] create mixins for common layout styles
1 parent ff9d691 commit 075b083

File tree

13 files changed

+158
-64
lines changed

13 files changed

+158
-64
lines changed

assets/mixins.scss

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
@mixin layout {
2+
@apply relative min-h-screen bg-white dark:bg-gray-800;
3+
}
4+
5+
@mixin layout-sidebar {
6+
@apply w-10 md:w-14 lg:w-16 fixed h-screen z-50;
7+
}
8+
9+
@mixin layout-head {
10+
@apply left-10 md:left-14 lg:left-16 h-12 right-0 fixed justify-between border-b border-gray-200 dark:border-gray-700 px-4 bg-white dark:bg-gray-800 z-50;
11+
}
12+
13+
@mixin layout-body {
14+
@apply flex flex-col flex-1 pt-12;
15+
}
16+
117
@mixin text-muted {
218
@apply text-gray-600 dark:text-gray-400;
319
}
@@ -10,10 +26,6 @@
1026
@apply text-2xs sm:text-xs md:text-sm lg:text-base;
1127
}
1228

13-
@mixin border-style {
14-
@apply border-gray-300 dark:border-gray-500 divide-gray-300 dark:divide-gray-500;
15-
}
16-
1729
@mixin loading {
1830
position: absolute;
1931
display: inline-block;

components/LayoutSidebar/LayoutSidebar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export default defineComponent({
8484

8585
<style lang="scss" scoped>
8686
.layout-sidebar {
87-
@apply bg-gray-200 dark:bg-gray-800 flex flex-col justify-between z-50 w-full h-full sticky top-0 h-screen max-h-screen;
87+
@apply bg-gray-200 dark:bg-gray-800 flex flex-col justify-between;
8888
}
8989
9090
.layout-sidebar__nav {

components/PageHeader/PageHeader.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ export default defineComponent({
4545

4646
<style lang="scss" scoped>
4747
.page-header {
48-
@apply p-3 flex justify-between border-b border-gray-200 dark:border-gray-700;
48+
@apply flex justify-between;
4949
}
5050
5151
.page-header__title {
52+
@apply flex items-center flex-row;
5253
}
5354
5455
.page-header__controls {

components/ProfilerPage/ProfilerPage.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ export default defineComponent({
223223
}
224224
225225
.profiler-page__edge {
226-
@apply bg-gray-800 absolute border border-gray-300 dark:border-gray-600;
227-
228-
z-index: 9999;
226+
@apply bg-gray-800 absolute border border-gray-300 dark:border-gray-600 z-50;
229227
}
230228
231229
.profiler-page__edge-title {

components/ProfilerPageCallGraph/ProfilerPageCallGraph.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,10 @@ export default defineComponent({
189189
190190
.profiler-page-call-graph--fullscreen {
191191
@apply rounded-none mt-0 top-0 left-0 fixed w-full h-full;
192-
z-index: 9998;
193192
}
194193
195194
.profiler-page-call-graph__toolbar {
196195
@apply absolute top-5 left-5 flex bg-gray-200 p-2 rounded gap-x-5;
197-
z-index: 9999;
198196
}
199197
200198
.profiler-page-call-graph__toolbar--right {

layouts/default.vue

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<template>
22
<div class="main-layout">
3-
<div class="main-layout__sidebar-wrap">
4-
<LayoutSidebar
5-
:is-connected="isConnected"
6-
:api-version="apiVersion"
7-
:client-version="clientVersion"
8-
/>
9-
</div>
3+
<LayoutSidebar
4+
class="main-layout__sidebar"
5+
:is-connected="isConnected"
6+
:api-version="apiVersion"
7+
:client-version="clientVersion"
8+
/>
109

1110
<div class="main-layout__content">
1211
<slot />
@@ -75,23 +74,29 @@ export default defineComponent({
7574
</script>
7675

7776
<style lang="scss" scoped>
77+
@import "assets/mixins";
78+
7879
.main-layout {
7980
@apply flex min-h-screen items-stretch relative;
8081
}
8182
82-
.main-layout__sidebar-wrap {
83-
@apply w-10 md:w-14 lg:w-16 flex-none border-r border-gray-200 dark:border-gray-700;
83+
.main-layout__sidebar {
84+
@apply w-10 md:w-14 lg:w-16 flex-none border-r border-gray-200 dark:border-gray-700 z-50 w-full h-full sticky top-0 h-screen max-h-screen;
85+
}
86+
87+
.main-layout__header {
88+
@apply flex-none w-full h-10;
8489
}
8590
8691
.main-layout__content {
87-
@apply flex flex-col h-full flex-1 w-full min-h-screen;
92+
@apply flex flex-col h-full flex-1 w-full min-h-screen absolute top-0 left-0 pl-10 md:pl-14 lg:pl-16;
8893
8994
& > div {
9095
@apply flex flex-col h-full flex-1;
9196
}
9297
}
9398
9499
.main-layout__sidebar {
95-
@apply w-10 md:w-14 lg:w-16 fixed h-screen;
100+
@include layout-sidebar;
96101
}
97102
</style>

pages/http-dumps/[id].vue

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<template>
22
<main class="http-dumps-event">
3-
<PageHeader button-title="Delete event" @delete="onDelete">
3+
<PageHeader
4+
class="http-dumps-event__head"
5+
button-title="Delete event"
6+
@delete="onDelete"
7+
>
48
<NuxtLink to="/">Home</NuxtLink>&nbsp;/
59
<NuxtLink to="/http-dumps">Http dumps</NuxtLink>&nbsp;/
610
<NuxtLink :disabled="true">{{ event.id }}</NuxtLink>
@@ -12,7 +16,9 @@
1216
<div></div>
1317
</div>
1418

15-
<HttpDumpPage v-if="event" :event="event" />
19+
<div class="http-dumps-event__body">
20+
<HttpDumpPage v-if="event" :event="event" />
21+
</div>
1622
</main>
1723
</template>
1824

@@ -71,9 +77,7 @@ export default defineComponent({
7177
},
7278
computed: {
7379
event() {
74-
return this.serverEvent
75-
? normalizeHttpDumpEvent(this.serverEvent)
76-
: null;
80+
return this.serverEvent ? normalizeHttpDumpEvent(this.serverEvent) : null;
7781
},
7882
},
7983
methods: {
@@ -89,9 +93,19 @@ export default defineComponent({
8993
<style lang="scss" scoped>
9094
@import "assets/mixins";
9195
.http-dumps-event {
92-
@apply h-full w-full;
96+
@include layout;
97+
}
98+
99+
.http-dumps-event__head {
100+
@include layout-head;
93101
}
102+
94103
.http-dumps-event__loading {
95104
@include loading;
105+
@include layout-body;
106+
}
107+
108+
.http-dumps-event__body {
109+
@include layout-body;
96110
}
97111
</style>

pages/index.vue

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<template>
22
<div class="events-page">
3-
<PageHeader button-title="Clear events" @delete="clearEvents">
3+
<PageHeader
4+
class="events-page__head"
5+
button-title="Clear events"
6+
@delete="clearEvents"
7+
>
48
<NuxtLink to="/" :disabled="!title">Home</NuxtLink>
59

610
<template v-if="title">
@@ -137,12 +141,17 @@ export default defineComponent({
137141
@import "assets/mixins";
138142
139143
.events-page {
140-
@apply h-full w-full;
144+
@include layout;
145+
}
146+
147+
.events-page__head {
148+
@include layout-head;
141149
}
142150
143151
.events-page__events {
152+
@include layout-body;
144153
@include border-style;
145-
@apply flex flex-col divide-y divide-y-2 divide-gray-200 dark:divide-gray-600;
154+
@apply divide-y divide-y-2 divide-gray-200 dark:divide-gray-600;
146155
}
147156
148157
.events-page__event {
@@ -152,7 +161,8 @@ export default defineComponent({
152161
}
153162
154163
.events-page__welcome {
155-
@apply flex-1 p-4 flex flex-col justify-center items-center bg-gray-50 dark:bg-gray-800 w-full h-full min-h-screen;
164+
@include layout-body;
165+
@apply flex-1 flex flex-col justify-center items-center bg-gray-50 dark:bg-gray-800 min-h-screen;
156166
}
157167
158168
.events-page__btn-stop-events {

pages/inspector/[id].vue

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<template>
22
<main class="inspector-event">
3-
<PageHeader button-title="Delete event" @delete="onDelete">
4-
<NuxtLink to="/">Home</NuxtLink>&nbsp;/
5-
<NuxtLink to="/inspector">Inspector</NuxtLink>&nbsp;/
3+
<PageHeader
4+
class="inspector-event__head"
5+
button-title="Delete event"
6+
@delete="onDelete"
7+
>
8+
<NuxtLink to="/">Home</NuxtLink>&nbsp;/&nbsp;
9+
<NuxtLink to="/inspector">Inspector</NuxtLink>&nbsp;/&nbsp;
610
<NuxtLink :disabled="true">{{ event.id }}</NuxtLink>
711
</PageHeader>
812

@@ -12,7 +16,9 @@
1216
<div></div>
1317
</div>
1418

15-
<InspectorPage v-if="event" :event="event" />
19+
<div class="inspector-event__body">
20+
<InspectorPage v-if="event" :event="event" />
21+
</div>
1622
</main>
1723
</template>
1824

@@ -89,9 +95,19 @@ export default defineComponent({
8995
<style lang="scss" scoped>
9096
@import "assets/mixins";
9197
.inspector-event {
92-
@apply h-full w-full;
98+
@include layout;
99+
}
100+
101+
.inspector-event__head {
102+
@include layout-head;
93103
}
104+
94105
.inspector-event__loading {
95106
@include loading;
107+
@include layout-body;
108+
}
109+
110+
.inspector-event__body {
111+
@include layout-body;
96112
}
97113
</style>

pages/profiler/[id].vue

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
<template>
22
<main class="profiler-event">
3-
<PageHeader button-title="Delete event" @delete="onDelete">
4-
<NuxtLink to="/">Home</NuxtLink>&nbsp;/
5-
<NuxtLink to="/profiler">Profiler</NuxtLink>&nbsp;/
3+
<PageHeader
4+
class="profiler-event__head"
5+
button-title="Delete event"
6+
@delete="onDelete"
7+
>
8+
<NuxtLink to="/">Home</NuxtLink>&nbsp;/&nbsp;
9+
<NuxtLink to="/profiler">Profiler</NuxtLink>&nbsp;/&nbsp;
610
<NuxtLink :disabled="true">{{ eventId }}</NuxtLink>
711
</PageHeader>
812

@@ -12,7 +16,9 @@
1216
<div></div>
1317
</div>
1418

15-
<ProfilerPage v-if="event" :event="event" />
19+
<div class="profiler-event__body">
20+
<ProfilerPage v-if="event" :event="event" />
21+
</div>
1622
</main>
1723
</template>
1824

@@ -85,23 +91,21 @@ export default defineComponent({
8591

8692
<style lang="scss" scoped>
8793
@import "assets/mixins";
88-
.profiler-event {
89-
@apply h-full w-full;
9094
91-
> main {
92-
@apply flex flex-col md:flex-row;
93-
}
94-
95-
.call-stack__wrapper {
96-
@apply w-full md:w-1/6 border-r border-gray-300 dark:border-gray-500;
97-
}
95+
.profiler-event {
96+
@include layout;
97+
}
9898
99-
.info__wrapper {
100-
@apply w-full h-full flex flex-col md:w-5/6 divide-y divide-gray-300 dark:divide-gray-500;
101-
}
99+
.profiler-event__head {
100+
@include layout-head;
102101
}
103102
104103
.profiler-event__loading {
105104
@include loading;
105+
@include layout-body;
106+
}
107+
108+
.profiler-event__body {
109+
@include layout-body;
106110
}
107111
</style>

0 commit comments

Comments
 (0)