2 Commits

Author SHA1 Message Date
7d1f346c4b Improve UiDrawer styling and viewport calculations 2025-11-08 23:14:12 +01:00
af61972342 Fix ui prop reference in UiDrawer component 2025-11-08 20:28:39 +01:00
3 changed files with 7 additions and 9 deletions

View File

@ -8,7 +8,7 @@
description="Workspaces" description="Workspaces"
> >
<template #content> <template #content>
<div class="pl-8 pr-4 h-full overflow-y-auto"> <div class="pl-8 pr-4 overflow-y-auto py-8">
<!-- Workspace Cards --> <!-- Workspace Cards -->
<div class="flex flex-col gap-3"> <div class="flex flex-col gap-3">
<HaexWorkspaceCard <HaexWorkspaceCard

View File

@ -3,7 +3,7 @@
v-bind="$attrs" v-bind="$attrs"
:ui="{ :ui="{
content: content:
'pb-[env(safe-area-inset-bottom)] pt-[env(safe-area-inset-top)] w-dvw max-w-md sm:max-w-fit', 'pb-[env(safe-area-inset-bottom)] pt-[env(safe-area-inset-top)] ',
...(ui || {}), ...(ui || {}),
}" }"
> >
@ -26,5 +26,7 @@ import type { DrawerProps } from '@nuxt/ui'
* Wrapper around UDrawer that automatically applies safe area insets for mobile devices. * Wrapper around UDrawer that automatically applies safe area insets for mobile devices.
* Passes through all props and slots to UDrawer. * Passes through all props and slots to UDrawer.
*/ */
defineProps</* @vue-ignore */ DrawerProps>() const props = defineProps</* @vue-ignore */ DrawerProps>()
const { ui } = toRefs(props)
</script> </script>

View File

@ -13,7 +13,7 @@ export interface ViewportDimensions {
*/ */
export function getViewportDimensions(): ViewportDimensions { export function getViewportDimensions(): ViewportDimensions {
const viewportWidth = window.innerWidth const viewportWidth = window.innerWidth
const viewportHeight = window.innerHeight - 60 // Subtract tab bar height const viewportHeight = window.innerHeight - 40 // Subtract header height
// Get safe-area-insets from CSS variables // Get safe-area-insets from CSS variables
const safeAreaTop = parseFloat( const safeAreaTop = parseFloat(
@ -45,11 +45,7 @@ export function getViewportDimensions(): ViewportDimensions {
*/ */
export function getAvailableContentHeight(): number { export function getAvailableContentHeight(): number {
const dimensions = getViewportDimensions() const dimensions = getViewportDimensions()
return ( return dimensions.height - dimensions.safeAreaTop - dimensions.safeAreaBottom
dimensions.height -
dimensions.safeAreaTop -
dimensions.safeAreaBottom
)
} }
/** /**