Skip to content

Commit

Permalink
chore: make searchbar absolute if fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviareichl committed Jun 6, 2024
1 parent 10ad0f3 commit 894de6e
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 17 deletions.
31 changes: 20 additions & 11 deletions components/data-map-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,30 @@ watch(data, () => {
</script>

<template>
<div class="relative grid grid-rows-[auto_1fr] gap-4">
<SearchForm
:filter="searchFilters.category"
:search="searchFilters.search"
@submit="onChangeSearchFilters"
/>
<div :class="project.fullscreen ? 'relative grid' : 'relative grid grid-rows-[auto_1fr] gap-4'">
<div class="absolute z-10 flex w-full justify-center">
<SearchForm
:class="
project.fullscreen
? 'bg-white dark:bg-neutral-900 max-w-[800px] w-full mt-2 rounded-md p-6 bg-opacity-90 shadow-md'
: ''
"
:filter="searchFilters.category"
:search="searchFilters.search"
@submit="onChangeSearchFilters"
/>
</div>

<VisualisationContainer
v-slot="{ height, width }"
class="border"
:class="{ 'opacity-50 grayscale': isLoading }"
>
<div class="absolute z-10 mt-2 flex w-full justify-center">
<Toggle variant="iiif" @click="togglePolygons"> {{ $t("DataMapView.polygon") }} </Toggle>
</div>
<div class="absolute bottom-0 z-10 mb-2 flex w-full justify-center">
<div
class="max-h-72 gap-2 overflow-y-auto overflow-x-hidden rounded-md border-2 border-transparent bg-white p-2 text-sm shadow-md"
class="max-h-72 gap-2 overflow-y-auto overflow-x-hidden rounded-md border-2 border-transparent bg-white bg-opacity-90 p-2 text-sm font-medium shadow-md dark:bg-neutral-900"
>
<div class="grid grid-cols-[auto_1fr] gap-3">
<div class="grid grid-cols-[auto_auto_1fr] items-center gap-3 align-middle">
<div class="grid grid-cols-[auto_1fr] gap-1">
<span
class="m-1.5 size-2 rounded-full"
Expand All @@ -175,6 +179,11 @@ watch(data, () => {
></span>
{{ $t("DataMapView.centerpoint") }} ({{ centerpoints.length }})
</div>
<div>
<Toggle variant="iiif" @click="togglePolygons">
{{ $t("DataMapView.polygon") }}
</Toggle>
</div>
</div>
</div>
</div>
Expand Down
16 changes: 13 additions & 3 deletions components/data-network-view.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { z } from "zod";
import type { SearchFormData as CategoryFormData } from "@/components/network-legend-panel.vue";
import type { SearchFormData } from "@/components/network-search-form.vue";
import { project } from "../config/project.config";
const router = useRouter();
const route = useRoute();
const t = useTranslations();
Expand Down Expand Up @@ -79,8 +81,16 @@ const systemClasses = computed(() => {
</script>

<template>
<div class="relative grid grid-rows-[auto_1fr] gap-4">
<NetworkSearchForm :search="searchFilters.search" @submit="onChangeSearchFilters" />
<div :class="project.fullscreen ? 'relative grid' : 'relative grid grid-rows-[auto_1fr] gap-4'">
<NetworkSearchForm
:class="
project.fullscreen
? 'absolute z-10 bg-white dark:bg-neutral-900 max-w-[800px] w-full m-3 rounded-md p-6 bg-opacity-90 shadow-md'
: ''
"
:search="searchFilters.search"
@submit="onChangeSearchFilters"
/>

<VisualisationContainer
v-slot="{ height, width }"
Expand All @@ -89,7 +99,7 @@ const systemClasses = computed(() => {
>
<NetworkLegendPanel
v-if="height && width"
class="absolute bottom-0 right-0 z-10 m-3"
class="absolute bottom-0 right-0 z-10 m-3 bg-opacity-90"
:system-classes="systemClasses"
@submit="onChangeCategory"
/>
Expand Down
4 changes: 3 additions & 1 deletion components/network-search-form.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { SearchIcon } from "lucide-vue-next";
import { project } from "../config/project.config";
export interface SearchFormData {
search: string;
}
Expand Down Expand Up @@ -35,7 +37,7 @@ const searchLabelId = "search-field";
@submit.prevent="onSubmit"
>
<div class="grid gap-y-1">
<Label :for="searchLabelId">{{ t("SearchForm.search") }}</Label>
<Label v-if="!project.fullscreen" :for="searchLabelId">{{ t("SearchForm.search") }}</Label>
<Input
:id="searchLabelId"
:default-value="props.search"
Expand Down
4 changes: 2 additions & 2 deletions components/search-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const searchLabelId = "search-field";
@submit.prevent="onSubmit"
>
<div class="grid gap-y-1">
<Label :for="filterLabelId">{{ t("SearchForm.filter") }}</Label>
<Label v-if="!project.fullscreen" :for="filterLabelId">{{ t("SearchForm.filter") }}</Label>
<!-- eslint-disable-next-line vuejs-accessibility/form-control-has-label -->
<Select name="category" :default-value="props.filter">
<SelectTrigger :id="filterLabelId" class="min-w-48">
Expand All @@ -55,7 +55,7 @@ const searchLabelId = "search-field";
</div>

<div class="grid gap-y-1">
<Label :for="searchLabelId">{{ t("SearchForm.search") }}</Label>
<Label v-if="!project.fullscreen" :for="searchLabelId">{{ t("SearchForm.search") }}</Label>
<Input
:id="searchLabelId"
:default-value="props.search"
Expand Down

0 comments on commit 894de6e

Please sign in to comment.