Skip to content

Commit

Permalink
Responsive: Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
ltouroumov committed Sep 10, 2024
1 parent f33941e commit 41a1bed
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 43 deletions.
7 changes: 7 additions & 0 deletions assets/css/bootstrap/global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
body {
background: $body-bg-dark;
}

// Black Magic
// https://stackoverflow.com/a/77722504
body:has(dialog[open]),
body:has(div.offcanvas.show) {
overflow: hidden;
}
2 changes: 2 additions & 0 deletions components/utils/ModalDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ dialog.modal-window {
display: none;
overflow: hidden;
overscroll-behavior: contain;
&.show {
position: fixed;
display: flex;
Expand Down
6 changes: 6 additions & 0 deletions components/utils/OffCanvas.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<div
class="offcanvas"
:class="[{ show: props.show, hiding: !props.show }, positionClass]"
v-bind="$attrs"
>
<div v-if="props.header ?? true" class="offcanvas-header">
<slot name="header" />
Expand All @@ -18,6 +19,11 @@
<slot />
</div>
</div>
<div
v-if="show"
class="offcanvas-backdrop fade show"
@click="$emit('close')"
></div>
</template>
<script setup lang="ts">
Expand Down
8 changes: 7 additions & 1 deletion components/viewer/ViewMenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@click="toggleProjectMenu()"
/>
</div>
<ViewScoreStatus />
<ViewScoreStatus short />
<div class="d-flex gap-1">
<button
class="btn btn-light btn-lg i-solar-magnifer-outline"
Expand All @@ -32,8 +32,14 @@ const { toggleBackpack, toggleSearch, toggleProjectMenu } = useViewerStore();
</script>

<style scoped lang="scss">
@import '~/assets/css/bootstrap/config';
.navbar {
position: sticky;
height: 40px;
}
body:has(.menu-modal.show) .navbar {
z-index: $zindex-offcanvas;
}
</style>
7 changes: 6 additions & 1 deletion components/viewer/ViewProjectObj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,30 @@ const {
obj,
preview = false,
width = null,
forceWidth = null,
alwaysEnable = false,
template = null,
} = defineProps<{
row: ProjectRow;
obj: ProjectObj;
preview?: boolean;
width?: string;
forceWidth?: string;
alwaysEnable?: boolean;
template?: string;
}>();
const objClass = computed(() => {
if (preview) return ['obj-preview'];
if (width) return ['col', { [width]: true }];
if (forceWidth) return ['col', { [forceWidth]: true }];
let objectSize = row.objectWidth;
if (obj.objectWidth) {
objectSize = obj.objectWidth;
}
if (width) {
objectSize = width;
}
if (objectSize in ObjectSizes) {
const classes = ObjectSizes[objectSize];
Expand Down
23 changes: 0 additions & 23 deletions components/viewer/ViewScoreBar.vue

This file was deleted.

9 changes: 6 additions & 3 deletions components/viewer/ViewScoreStatus.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<template>
<div class="d-flex gap-3" :class="{ 'flex-column': vertical }">
<div class="d-flex gap-2" :class="{ 'flex-column': vertical }">
<span
v-for="{ score, value } in activeScores"
:key="score.id"
class="d-flex score flex-row gap-2"
>
<span v-if="score.beforeText && !short" class="d-none d-sm-block">
<span
v-if="score.beforeText"
:class="short ? ['d-none', 'd-sm-block'] : []"
>
{{ score.beforeText }}
</span>
<span>{{ -value }}</span>
Expand All @@ -21,7 +24,7 @@ import { computed } from 'vue';
import { PointType } from '~/composables/project';
import { useProjectRefs } from '~/composables/store/project';
const { vertical, short = true } = defineProps<{
const { vertical, short = false } = defineProps<{
vertical?: boolean;
short?: boolean;
}>();
Expand Down
6 changes: 6 additions & 0 deletions components/viewer/modal/BackpackModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,10 @@ const packRows = computed(() => {
flex-grow: 1;
}
}
@media screen and (max-width: 768px) {
.pack-import-export {
flex-direction: column;
}
}
</style>
28 changes: 15 additions & 13 deletions components/viewer/modal/MenuModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</div>
<div v-if="selected === 'save-load'">
<ImportCode />
<hr />
<ExportCode />
</div>
<div v-if="selected === 'library'">
Expand All @@ -67,19 +68,6 @@ const selected = ref<string>('project');
<style scoped lang="scss">
@import '~/assets/css/bootstrap/config';
.menu-modal {
margin-top: 40px;
max-width: 50%;
width: auto;
}
@media screen and (max-width: 768px) {
.menu-modal {
width: 100%;
max-width: 100%;
}
}
.pack-import-export {
display: grid;
gap: 0.5rem;
Expand Down Expand Up @@ -125,3 +113,17 @@ const selected = ref<string>('project');
}
}
</style>

<style lang="scss">
.menu-modal {
margin-top: 40px;
width: 768px !important;
}
@media screen and (max-width: 768px) {
.menu-modal {
width: 100% !important;
max-width: 100%;
}
}
</style>
2 changes: 1 addition & 1 deletion components/viewer/utils/ExportCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ function copyExportText() {
flex-direction: column;
gap: 1rem;
min-width: 500px;
// min-width: 500px;
.export-code,
.export-text {
Expand Down
2 changes: 1 addition & 1 deletion components/viewer/utils/ImportCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ function readImportCode() {
flex-direction: column;
gap: 0.5rem;
min-width: 500px;
// min-width: 500px;
}
</style>

0 comments on commit 41a1bed

Please sign in to comment.