From 267f72f84c6a5979eae696dae8fddee25188c1bb Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Fri, 15 Mar 2024 21:06:13 +0000 Subject: ui(mobile): New header style in the app --- apps/mobile/app/dashboard/(tabs)/_layout.tsx | 2 +- apps/mobile/app/dashboard/(tabs)/index.tsx | 90 ++++++++++++----------- apps/mobile/app/dashboard/(tabs)/lists.tsx | 45 +++++++----- apps/mobile/app/dashboard/(tabs)/search.tsx | 36 +++++---- apps/mobile/app/dashboard/(tabs)/settings.tsx | 24 +++--- apps/mobile/app/dashboard/_layout.tsx | 8 +- apps/mobile/app/dashboard/archive.tsx | 9 ++- apps/mobile/app/dashboard/favourites.tsx | 13 +++- apps/mobile/app/dashboard/lists/[slug].tsx | 17 +++-- apps/mobile/app/dashboard/tags/[slug].tsx | 19 +++-- apps/mobile/components/bookmarks/BookmarkList.tsx | 9 ++- apps/mobile/components/ui/PageTitle.tsx | 5 ++ 12 files changed, 163 insertions(+), 114 deletions(-) create mode 100644 apps/mobile/components/ui/PageTitle.tsx (limited to 'apps') diff --git a/apps/mobile/app/dashboard/(tabs)/_layout.tsx b/apps/mobile/app/dashboard/(tabs)/_layout.tsx index ce73a5c9..db6656b2 100644 --- a/apps/mobile/app/dashboard/(tabs)/_layout.tsx +++ b/apps/mobile/app/dashboard/(tabs)/_layout.tsx @@ -4,7 +4,7 @@ import { ClipboardList, Home, Search, Settings } from "lucide-react-native"; export default function TabLayout() { return ( - + { - Haptics.selectionAsync(); - if (nativeEvent.event === "note") { - router.navigate("dashboard/add-note"); - } else if (nativeEvent.event === "link") { - router.navigate("dashboard/add-link"); - } - }} - actions={[ - { - id: "link", - title: "New Link", - image: Platform.select({ - ios: "link", - android: "ic_menu_link", - }), - }, - { - id: "note", - title: "New Note", - image: Platform.select({ - ios: "note", - android: "ic_menu_note", - }), - }, - ]} - shouldOpenOnLongPress={false} - > - - Haptics.selectionAsync()} - /> - - + { + Haptics.selectionAsync(); + if (nativeEvent.event === "note") { + router.navigate("dashboard/add-note"); + } else if (nativeEvent.event === "link") { + router.navigate("dashboard/add-link"); + } + }} + actions={[ + { + id: "link", + title: "New Link", + image: Platform.select({ + ios: "link", + android: "ic_menu_link", + }), + }, + { + id: "note", + title: "New Note", + image: Platform.select({ + ios: "note", + android: "ic_menu_note", + }), + }, + ]} + shouldOpenOnLongPress={false} + > + + Haptics.selectionAsync()} /> + + ); } export default function Home() { return ( - <> - , - }} + + + + + + } /> - - + ); } diff --git a/apps/mobile/app/dashboard/(tabs)/lists.tsx b/apps/mobile/app/dashboard/(tabs)/lists.tsx index 2aece541..e0ed8489 100644 --- a/apps/mobile/app/dashboard/(tabs)/lists.tsx +++ b/apps/mobile/app/dashboard/(tabs)/lists.tsx @@ -1,8 +1,9 @@ import { useEffect, useState } from "react"; -import { FlatList, View, Text, Pressable } from "react-native"; +import { FlatList, Pressable, SafeAreaView, Text, View } from "react-native"; import { Link } from "expo-router"; import { api } from "@/lib/trpc"; import { ChevronRight } from "lucide-react-native"; +import PageTitle from "@/components/ui/PageTitle"; export default function Lists() { const [refreshing, setRefreshing] = useState(false); @@ -47,24 +48,28 @@ export default function Lists() { ); return ( - ( - - - - {l.item.logo} {l.item.name} - - - - - )} - data={links} - refreshing={refreshing} - onRefresh={onRefresh} - /> + + + } + contentContainerStyle={{ + gap: 5, + }} + renderItem={(l) => ( + + + + {l.item.logo} {l.item.name} + + + + + )} + data={links} + refreshing={refreshing} + onRefresh={onRefresh} + /> + ); } diff --git a/apps/mobile/app/dashboard/(tabs)/search.tsx b/apps/mobile/app/dashboard/(tabs)/search.tsx index 043dffab..76e9aef9 100644 --- a/apps/mobile/app/dashboard/(tabs)/search.tsx +++ b/apps/mobile/app/dashboard/(tabs)/search.tsx @@ -1,11 +1,11 @@ import { useState } from "react"; -import { View } from "react-native"; +import { SafeAreaView, View } from "react-native"; import BookmarkList from "@/components/bookmarks/BookmarkList"; -import { Divider } from "@/components/ui/Divider"; import { Input } from "@/components/ui/Input"; import { api } from "@/lib/trpc"; import { keepPreviousData } from "@tanstack/react-query"; import { useDebounce } from "use-debounce"; +import PageTitle from "@/components/ui/PageTitle"; export default function Search() { const [search, setSearch] = useState(""); @@ -18,17 +18,25 @@ export default function Search() { ); return ( - - - - {data && b.id)} />} - + + {data && ( + b.id)} + header={ + + + + + } + /> + )} + ); } diff --git a/apps/mobile/app/dashboard/(tabs)/settings.tsx b/apps/mobile/app/dashboard/(tabs)/settings.tsx index 81b21fc8..fe138f52 100644 --- a/apps/mobile/app/dashboard/(tabs)/settings.tsx +++ b/apps/mobile/app/dashboard/(tabs)/settings.tsx @@ -1,10 +1,10 @@ import { useEffect } from "react"; -import { Text, View } from "react-native"; +import { SafeAreaView, Text, View } from "react-native"; import { useRouter } from "expo-router"; -import Logo from "@/components/Logo"; import { Button } from "@/components/ui/Button"; import { useSession } from "@/lib/session"; import { api } from "@/lib/trpc"; +import PageTitle from "@/components/ui/PageTitle"; export default function Dashboard() { const router = useRouter(); @@ -26,15 +26,17 @@ export default function Dashboard() { }, [error]); return ( - - - - - {isLoading ? "Loading ..." : data?.email} - - + + + + + + {isLoading ? "Loading ..." : data?.email} + + -