aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/components/bookmarks
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-04-17 17:56:21 +0100
committerMohamedBassem <me@mbassem.com>2024-04-17 18:13:31 +0100
commitc46482cdaaf883971736488750513663dd023076 (patch)
tree9e3d70fd9e7ae39f8ef21e0651049558e5c5fa5b /apps/mobile/components/bookmarks
parentbb44ebcb9967bde81d15e2f7858d515777681c10 (diff)
downloadkarakeep-c46482cdaaf883971736488750513663dd023076.tar.zst
mobile: Add dark mode support
Diffstat (limited to 'apps/mobile/components/bookmarks')
-rw-r--r--apps/mobile/components/bookmarks/BookmarkCard.tsx41
-rw-r--r--apps/mobile/components/bookmarks/BookmarkList.tsx2
-rw-r--r--apps/mobile/components/bookmarks/UpdatingBookmarkList.tsx4
3 files changed, 35 insertions, 12 deletions
diff --git a/apps/mobile/components/bookmarks/BookmarkCard.tsx b/apps/mobile/components/bookmarks/BookmarkCard.tsx
index 76a05aef..9e5febe3 100644
--- a/apps/mobile/components/bookmarks/BookmarkCard.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkCard.tsx
@@ -22,6 +22,7 @@ import {
useUpdateBookmark,
} from "@hoarder/shared-react/hooks/bookmarks";
+import { TailwindResolver } from "../TailwindResolver";
import { Divider } from "../ui/Divider";
import { Skeleton } from "../ui/Skeleton";
import { useToast } from "../ui/Toast";
@@ -162,9 +163,11 @@ function TagList({ bookmark }: { bookmark: ZBookmark }) {
{tags.map((t) => (
<View
key={t.id}
- className="rounded-full border border-gray-200 px-2.5 py-0.5 text-xs font-semibold"
+ className="rounded-full border border-accent px-2.5 py-0.5 text-xs font-semibold"
>
- <Link href={`dashboard/tags/${t.id}`}>{t.name}</Link>
+ <Link className="text-foreground" href={`dashboard/tags/${t.id}`}>
+ {t.name}
+ </Link>
</View>
))}
</View>
@@ -198,7 +201,7 @@ function LinkCard({ bookmark }: { bookmark: ZBookmark }) {
{imageComp}
<View className="flex gap-2 p-2">
<Text
- className="line-clamp-2 text-xl font-bold"
+ className="line-clamp-2 text-xl font-bold text-foreground"
onPress={() => WebBrowser.openBrowserAsync(url)}
>
{bookmark.title ?? bookmark.content.title ?? parsedUrl.host}
@@ -206,7 +209,9 @@ function LinkCard({ bookmark }: { bookmark: ZBookmark }) {
<TagList bookmark={bookmark} />
<Divider orientation="vertical" className="mt-2 h-0.5 w-full" />
<View className="mt-2 flex flex-row justify-between px-2 pb-2">
- <Text className="my-auto line-clamp-1">{parsedUrl.host}</Text>
+ <Text className="my-auto line-clamp-1 text-foreground">
+ {parsedUrl.host}
+ </Text>
<ActionBar bookmark={bookmark} />
</View>
</View>
@@ -218,13 +223,29 @@ function TextCard({ bookmark }: { bookmark: ZBookmark }) {
if (bookmark.content.type !== "text") {
throw new Error("Wrong content type rendered");
}
+ const content = bookmark.content.text;
return (
<View className="flex max-h-96 gap-2 p-2">
{bookmark.title && (
- <Text className="line-clamp-2 text-xl font-bold">{bookmark.title}</Text>
+ <Text className="line-clamp-2 text-xl font-bold text-foreground">
+ {bookmark.title}
+ </Text>
)}
- <View className="max-h-56 overflow-hidden p-2">
- <Markdown>{bookmark.content.text}</Markdown>
+ <View className="max-h-56 overflow-hidden p-2 text-foreground">
+ <TailwindResolver
+ className="text-foreground"
+ comp={(styles) => (
+ <Markdown
+ style={{
+ text: {
+ color: styles?.color?.toString(),
+ },
+ }}
+ >
+ {content}
+ </Markdown>
+ )}
+ />
</View>
<TagList bookmark={bookmark} />
<Divider orientation="vertical" className="mt-2 h-0.5 w-full" />
@@ -256,7 +277,9 @@ function AssetCard({ bookmark }: { bookmark: ZBookmark }) {
/>
<View className="flex gap-2 p-2">
{title && (
- <Text className="line-clamp-2 text-xl font-bold">{title}</Text>
+ <Text className="line-clamp-2 text-xl font-bold text-foreground">
+ {title}
+ </Text>
)}
<TagList bookmark={bookmark} />
<Divider orientation="vertical" className="mt-2 h-0.5 w-full" />
@@ -307,5 +330,5 @@ export default function BookmarkCard({
break;
}
- return <View className="border-b border-gray-300 bg-white">{comp}</View>;
+ return <View className="border-b border-accent bg-background">{comp}</View>;
}
diff --git a/apps/mobile/components/bookmarks/BookmarkList.tsx b/apps/mobile/components/bookmarks/BookmarkList.tsx
index 7477992d..3ad23072 100644
--- a/apps/mobile/components/bookmarks/BookmarkList.tsx
+++ b/apps/mobile/components/bookmarks/BookmarkList.tsx
@@ -37,7 +37,7 @@ export default function BookmarkList({
renderItem={(b) => <BookmarkCard bookmark={b.item} />}
ListEmptyComponent={
<View className="items-center justify-center pt-4">
- <Text className="text-xl">No Bookmarks</Text>
+ <Text className="text-xl text-foreground">No Bookmarks</Text>
</View>
}
data={bookmarks}
diff --git a/apps/mobile/components/bookmarks/UpdatingBookmarkList.tsx b/apps/mobile/components/bookmarks/UpdatingBookmarkList.tsx
index 8495ee22..efc0d5e7 100644
--- a/apps/mobile/components/bookmarks/UpdatingBookmarkList.tsx
+++ b/apps/mobile/components/bookmarks/UpdatingBookmarkList.tsx
@@ -4,7 +4,7 @@ import { api } from "@/lib/trpc";
import type { ZGetBookmarksRequest } from "@hoarder/trpc/types/bookmarks";
import FullPageSpinner from "../ui/FullPageSpinner";
-import BookmarkList2 from "./BookmarkList";
+import BookmarkList from "./BookmarkList";
export default function UpdatingBookmarkList({
query,
@@ -40,7 +40,7 @@ export default function UpdatingBookmarkList({
};
return (
- <BookmarkList2
+ <BookmarkList
bookmarks={data.pages.flatMap((p) => p.bookmarks)}
header={header}
onRefresh={onRefresh}