generated from acdh-oeaw/template-app-nuxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: make the detail view responsive
- Loading branch information
1 parent
2d564a3
commit 2dea79a
Showing
3 changed files
with
205 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<script setup lang="ts"> | ||
import { UserRoundIcon, UserRoundPenIcon, VenetianMaskIcon } from "lucide-vue-next"; | ||
const props = defineProps<{ | ||
fictionality: string; | ||
isMobile: boolean; | ||
}>(); | ||
type Icon = typeof UserRoundIcon; | ||
const characterIcons: Record<string, Icon> = { | ||
fiktivefigur: UserRoundPenIcon, | ||
historischefigur: UserRoundIcon, | ||
mythologischefigur: VenetianMaskIcon, | ||
}; | ||
const iconComponent = computed(() => { | ||
const normalizedFictionality = props.fictionality | ||
.toLowerCase() | ||
.replace(/[-\s,]/g, "") // Removes dashes, spaces, and commas | ||
.replace(/[^a-zA-Zäöüß]/g, ""); // Removes any non-alphabet characters except for umlauts and ß | ||
return characterIcons[normalizedFictionality] ?? null; | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div v-if="props.isMobile"> | ||
<Popover> | ||
<PopoverTrigger> | ||
<component :is="iconComponent" :size="16" class="inline text-frisch-orange" /> | ||
</PopoverTrigger> | ||
<PopoverContent> | ||
<p>{{ props.fictionality }}</p> | ||
</PopoverContent> | ||
</Popover> | ||
</div> | ||
<div v-else> | ||
<TooltipProvider> | ||
<Tooltip> | ||
<TooltipTrigger as-child> | ||
<component :is="iconComponent" :size="16" class="inline text-frisch-orange" /> | ||
</TooltipTrigger> | ||
<TooltipContent> | ||
<p>{{ props.fictionality }}</p> | ||
</TooltipContent> | ||
</Tooltip> | ||
</TooltipProvider> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.