Add NoModules and NoIntruments texts when filter leads to no result.

This commit is contained in:
Lorenz Padberg 2023-08-30 11:13:43 +02:00
parent b24c5419f1
commit acbb8b7517
2 changed files with 59 additions and 1 deletions

View File

@ -17,6 +17,10 @@
<language-switcher class="module-filter__language-switcher" /> <language-switcher class="module-filter__language-switcher" />
</div> </div>
<div class="module-filter__nomodules" v-if="modules.length > 1 && filteredModules.length === 0">
<info-icon class="module-filter__nomodules-icon" />
<span class="module-filter__nomodules-text">Für die ausgewählten Filtereinstellungen sind keine Module vorhanden</span>
</div>
<div class="topic__modules"> <div class="topic__modules">
<module-teaser <module-teaser
v-for="module in filteredModules" v-for="module in filteredModules"
@ -35,6 +39,7 @@ import Dropdown from '@/components/ui/Dropdown.vue';
import LanguageSwitcher from '@/components/LanguageSwitcher.vue'; import LanguageSwitcher from '@/components/LanguageSwitcher.vue';
import { graphql } from '@/__generated__'; import { graphql } from '@/__generated__';
import { ModuleCategoryNode, ModuleLevelNode, ModuleNode, PrivateUserNode } from '@/__generated__/graphql'; import { ModuleCategoryNode, ModuleLevelNode, ModuleNode, PrivateUserNode } from '@/__generated__/graphql';
import InfoIcon from "@/components/icons/InfoIcon.vue";
const props = defineProps<{ const props = defineProps<{
modules: ModuleNode[]; modules: ModuleNode[];
@ -161,6 +166,7 @@ const updateLastModuleLevelUser = (moduleLevel: ModuleLevelNode) => {
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
column-gap: $medium-spacing; column-gap: $medium-spacing;
margin-bottom: $medium-spacing;
} }
&__dropdown { &__dropdown {
@ -170,6 +176,25 @@ const updateLastModuleLevelUser = (moduleLevel: ModuleLevelNode) => {
&__language-switcher { &__language-switcher {
margin-left: auto; margin-left: auto;
} }
&__nomodules {
display: flex;
align-items: center;
}
&__nomodules-icon {
width: 40px;
height: 40px;
fill: $color-brand;
margin-right: 8px;
}
&__nomodules-text {
color: $color-brand;
font-family: $sans-serif-font-family;
font-weight: $font-weight-regular;
margin-right: $medium-spacing;
}
} }
.topic { .topic {

View File

@ -10,7 +10,19 @@
v-else v-else
/> />
<div class="instrument-overview__list"> <div class="instrument-overview__list">
<FilterBar :search-query="searchText" @update:searchQuery="val => searchText = val"></FilterBar> <FilterBar
:search-query="searchText"
@update:searchQuery="(val) => (searchText = val)"
></FilterBar>
<div
class="instrument-overview__noinstruments"
v-if="instruments.length > 1 && filteredInstruments.length === 0"
>
<info-icon class="instrument-overview__noinstruments-icon" />
<span class="instrument-overview__noinstruments-text"
>Für die ausgewählten Filtereinstellungen sind keine Einträge vorhanden</span
>
</div>
<router-link <router-link
:to="{ name: 'instrument', params: { slug: instrument.slug } }" :to="{ name: 'instrument', params: { slug: instrument.slug } }"
data-cy="instrument" data-cy="instrument"
@ -30,9 +42,11 @@ import INSTRUMENTS_QUERY from '@/graphql/gql/queries/instrumentsQuery.gql';
import INSTRUMENT_FILTER_QUERY from 'gql/local/instrumentFilter.gql'; import INSTRUMENT_FILTER_QUERY from 'gql/local/instrumentFilter.gql';
import FilterBar from '@/components/instruments/FilterBar.vue'; import FilterBar from '@/components/instruments/FilterBar.vue';
import { graphql } from '@/__generated__'; import { graphql } from '@/__generated__';
import InfoIcon from '@/components/icons/InfoIcon.vue';
export default { export default {
components: { components: {
InfoIcon,
FilterBar, FilterBar,
InstrumentFilter, InstrumentFilter,
InstrumentEntry, InstrumentEntry,
@ -135,5 +149,24 @@ export default {
@include regular-text; @include regular-text;
@include table-row($color-silver); @include table-row($color-silver);
} }
&__noinstruments {
display: flex;
align-items: center;
}
&__noinstruments-icon {
width: 40px;
height: 40px;
fill: $color-brand;
margin-right: 8px;
}
&__noinstruments-text {
color: $color-brand;
font-family: $sans-serif-font-family;
font-weight: $font-weight-regular;
margin-right: $medium-spacing;
}
} }
</style> </style>