Refine admin PWA layout and tamagui usage
This commit is contained in:
@@ -16,9 +16,11 @@ export type NavKey = 'home' | 'tasks' | 'uploads' | 'profile';
|
||||
export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate: (key: NavKey) => void }) {
|
||||
const { t } = useTranslation('mobile');
|
||||
const location = useLocation();
|
||||
const { surface, border, primary, accentSoft, muted, subtle, shadow } = useAdminTheme();
|
||||
const surfaceColor = surface;
|
||||
const navSurface = withAlpha(surfaceColor, 0.92);
|
||||
const { surface, border, primary, accent, muted, subtle, shadow, glassSurfaceStrong, glassBorder, glassShadow } = useAdminTheme();
|
||||
const surfaceColor = glassSurfaceStrong ?? surface;
|
||||
const navSurface = glassSurfaceStrong ?? withAlpha(surfaceColor, 0.92);
|
||||
const navBorder = glassBorder ?? border;
|
||||
const navShadow = glassShadow ?? shadow;
|
||||
const [pressedKey, setPressedKey] = React.useState<NavKey | null>(null);
|
||||
|
||||
const isDeepHome = active === 'home' && location.pathname !== adminPath('/mobile/dashboard');
|
||||
@@ -38,14 +40,14 @@ export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate:
|
||||
right={0}
|
||||
backgroundColor={navSurface}
|
||||
borderTopWidth={1}
|
||||
borderColor={border}
|
||||
borderColor={navBorder}
|
||||
paddingVertical="$2"
|
||||
paddingHorizontal="$4"
|
||||
zIndex={50}
|
||||
shadowColor={shadow}
|
||||
shadowOpacity={0.08}
|
||||
shadowRadius={12}
|
||||
shadowOffset={{ width: 0, height: -4 }}
|
||||
shadowColor={navShadow}
|
||||
shadowOpacity={0.12}
|
||||
shadowRadius={16}
|
||||
shadowOffset={{ width: 0, height: -6 }}
|
||||
// allow for safe-area inset on modern phones
|
||||
style={{
|
||||
paddingBottom: 'max(env(safe-area-inset-bottom, 0px), 8px)',
|
||||
@@ -58,6 +60,8 @@ export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate:
|
||||
const activeState = item.key === active;
|
||||
const isPressed = pressedKey === item.key;
|
||||
const IconCmp = item.icon;
|
||||
const activeBg = primary;
|
||||
const activeShadow = withAlpha(primary, 0.4);
|
||||
return (
|
||||
<Pressable
|
||||
key={item.key}
|
||||
@@ -78,9 +82,10 @@ export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate:
|
||||
paddingHorizontal="$3"
|
||||
paddingVertical="$2"
|
||||
borderRadius={12}
|
||||
backgroundColor={activeState ? accentSoft : 'transparent'}
|
||||
backgroundColor={activeState ? activeBg : 'transparent'}
|
||||
gap="$1"
|
||||
style={{
|
||||
boxShadow: activeState ? `0 10px 22px ${activeShadow}` : undefined,
|
||||
transform: isPressed ? 'scale(0.96)' : 'scale(1)',
|
||||
opacity: isPressed ? 0.9 : 1,
|
||||
transition: 'transform 140ms ease, background-color 140ms ease, opacity 140ms ease',
|
||||
@@ -93,17 +98,17 @@ export function BottomNav({ active, onNavigate }: { active: NavKey; onNavigate:
|
||||
width={28}
|
||||
height={3}
|
||||
borderRadius={999}
|
||||
backgroundColor={primary}
|
||||
backgroundColor={accent}
|
||||
/>
|
||||
) : null}
|
||||
<YStack width={ICON_SIZE} height={ICON_SIZE} alignItems="center" justifyContent="center" shrink={0}>
|
||||
<IconCmp size={ICON_SIZE} color={activeState ? primary : subtle} />
|
||||
<IconCmp size={ICON_SIZE} color={activeState ? 'white' : subtle} />
|
||||
</YStack>
|
||||
<Text
|
||||
fontSize="$xs"
|
||||
fontWeight="700"
|
||||
fontFamily="$body"
|
||||
color={activeState ? primary : muted}
|
||||
color={activeState ? 'white' : muted}
|
||||
textAlign="center"
|
||||
flexShrink={1}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user