fix(mobile): use glass for pending cards
This commit is contained in:
1 parent
990bb0b689
commit
c892ac29d4
3 files changed
+41
-4
No files matched your search
@@ -3,6 +3,7 @@ import { Pressable, View } from "react-native";
|
||||
|
||||
import { AppText as Text } from "../../components/AppText";
|
||||
import type { PendingApproval } from "../../lib/threadActivity";
|
||||
import { PendingCardSurface } from "./PendingCardSurface";
|
||||
|
||||
export interface PendingApprovalCardProps {
|
||||
readonly approval: PendingApproval;
|
||||
@@ -15,7 +16,7 @@ export interface PendingApprovalCardProps {
|
||||
|
||||
export function PendingApprovalCard(props: PendingApprovalCardProps) {
|
||||
return (
|
||||
<View className="gap-2.5 rounded-[20px] border border-neutral-200 bg-neutral-100/80 p-4 dark:border-white/6 dark:bg-neutral-900/80">
|
||||
<PendingCardSurface>
|
||||
<Text className="font-t3-bold text-2xs uppercase tracking-[1.1px] text-sky-700 dark:text-sky-300">
|
||||
Approval needed
|
||||
</Text>
|
||||
@@ -52,6 +53,6 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
|
||||
<Text className="font-t3-bold text-sm text-rose-700 dark:text-rose-300">Decline</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
</View>
|
||||
</PendingCardSurface>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass";
|
||||
import type { ReactNode } from "react";
|
||||
import { useColorScheme, View, type ViewStyle } from "react-native";
|
||||
|
||||
const SURFACE_STYLE: ViewStyle = {
|
||||
borderRadius: 20,
|
||||
overflow: "hidden",
|
||||
};
|
||||
|
||||
export function PendingCardSurface(props: { readonly children: ReactNode }) {
|
||||
const isDarkMode = useColorScheme() === "dark";
|
||||
const content = <View className="gap-2.5 p-4">{props.children}</View>;
|
||||
|
||||
if (isLiquidGlassSupported) {
|
||||
return (
|
||||
<LiquidGlassView
|
||||
effect="regular"
|
||||
interactive
|
||||
colorScheme={isDarkMode ? "dark" : "light"}
|
||||
style={SURFACE_STYLE}
|
||||
>
|
||||
{content}
|
||||
</LiquidGlassView>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<View
|
||||
className="rounded-[20px] border border-neutral-200 bg-neutral-100 dark:border-white/6 dark:bg-neutral-900"
|
||||
style={SURFACE_STYLE}
|
||||
>
|
||||
{content}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import { Pressable, View } from "react-native";
|
||||
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
|
||||
import { cn } from "../../lib/cn";
|
||||
import type { PendingUserInput, PendingUserInputDraftAnswer } from "../../lib/threadActivity";
|
||||
import { PendingCardSurface } from "./PendingCardSurface";
|
||||
|
||||
export interface PendingUserInputCardProps {
|
||||
readonly pendingUserInput: PendingUserInput;
|
||||
@@ -25,7 +26,7 @@ export interface PendingUserInputCardProps {
|
||||
|
||||
export function PendingUserInputCard(props: PendingUserInputCardProps) {
|
||||
return (
|
||||
<View className="gap-2.5 rounded-[20px] border border-neutral-200 bg-neutral-100/80 p-4 dark:border-white/6 dark:bg-neutral-900/80">
|
||||
<PendingCardSurface>
|
||||
<Text className="font-t3-bold text-2xs uppercase tracking-[1.1px] text-sky-700 dark:text-sky-300">
|
||||
User input needed
|
||||
</Text>
|
||||
@@ -100,6 +101,6 @@ export function PendingUserInputCard(props: PendingUserInputCardProps) {
|
||||
>
|
||||
<Text className="font-t3-extrabold text-sm text-white">Submit answers</Text>
|
||||
</Pressable>
|
||||
</View>
|
||||
</PendingCardSurface>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user