diff --git a/apps/mobile/src/components/AndroidScreenHeader.tsx b/apps/mobile/src/components/AndroidScreenHeader.tsx index 1ae2464e0a77..dbdab5b184fd 100644 --- a/apps/mobile/src/components/AndroidScreenHeader.tsx +++ b/apps/mobile/src/components/AndroidScreenHeader.tsx @@ -4,7 +4,7 @@ import { ActivityIndicator, View } from "react-native"; import type { AppSymbolName } from "./AppSymbol"; import { AppText as Text } from "./AppText"; import { cn } from "../lib/cn"; -import { MaterialIconButton } from "./MaterialIconButton"; +import { IconButton } from "./IconButton"; import { AndroidAnchoredMenu } from "./AndroidAnchoredMenu"; import { splitAndroidHeaderActions } from "./headerMenu.android"; import { useScaledTextRole } from "../features/settings/appearance/useScaledTextRole"; @@ -28,7 +28,7 @@ export function AndroidHeaderIconButton(props: { readonly disabled?: boolean; readonly selected?: boolean; }) { - return ; + return ; } export function AndroidScreenHeader(props: { @@ -64,7 +64,7 @@ export function AndroidScreenHeader(props: { > {props.onBack ? ( - {(open) => ( - void; - readonly disabled?: boolean; - readonly selected?: boolean; - readonly variant?: "standard" | "primary" | "tonal" | "danger"; - readonly tintColorClassName?: string; -}) { +export function IconButton(props: IconButtonProps) { const { colors } = useControlTheme(); const { iconSize, buttonSize } = useAndroidControlSizing(); const variant = props.variant ?? "standard"; const Component = variant === "standard" - ? IconButton + ? ComposeIconButton : variant === "tonal" ? FilledTonalIconButton : FilledIconButton; diff --git a/apps/mobile/src/components/MaterialIconButton.tsx b/apps/mobile/src/components/IconButton.tsx similarity index 77% rename from apps/mobile/src/components/MaterialIconButton.tsx rename to apps/mobile/src/components/IconButton.tsx index a788fdd5ea35..af5fc634fdab 100644 --- a/apps/mobile/src/components/MaterialIconButton.tsx +++ b/apps/mobile/src/components/IconButton.tsx @@ -1,7 +1,8 @@ +import type { IconButtonProps } from "./IconButton.types"; import { cn } from "../lib/cn"; import { Pressable } from "react-native"; -import { SymbolView, type AppSymbolName } from "./AppSymbol"; +import { SymbolView } from "./AppSymbol"; const VARIANT_CLASS_NAMES = { standard: ["", "accent-foreground"], @@ -10,15 +11,7 @@ const VARIANT_CLASS_NAMES = { tonal: ["rounded-full bg-secondary", "accent-secondary-foreground"], } as const; -export function MaterialIconButton(props: { - readonly accessibilityLabel: string; - readonly icon: AppSymbolName; - readonly onPress?: () => void; - readonly disabled?: boolean; - readonly selected?: boolean; - readonly variant?: "standard" | "primary" | "tonal" | "danger"; - readonly tintColorClassName?: string; -}) { +export function IconButton(props: IconButtonProps) { const variant = props.variant ?? "standard"; const [containerClassName, iconTintClassName] = VARIANT_CLASS_NAMES[variant]; return ( diff --git a/apps/mobile/src/components/IconButton.types.ts b/apps/mobile/src/components/IconButton.types.ts new file mode 100644 index 000000000000..df5c3124a362 --- /dev/null +++ b/apps/mobile/src/components/IconButton.types.ts @@ -0,0 +1,11 @@ +import type { AppSymbolName } from "./AppSymbol"; + +export interface IconButtonProps { + readonly accessibilityLabel: string; + readonly icon: AppSymbolName; + readonly onPress?: () => void; + readonly disabled?: boolean; + readonly selected?: boolean; + readonly variant?: "standard" | "primary" | "tonal" | "danger"; + readonly tintColorClassName?: string; +} diff --git a/apps/mobile/src/components/NumberField.android.tsx b/apps/mobile/src/components/NumberField.android.tsx index 23095ee862fb..1a4f9b750bbb 100644 --- a/apps/mobile/src/components/NumberField.android.tsx +++ b/apps/mobile/src/components/NumberField.android.tsx @@ -1,7 +1,7 @@ import { View } from "react-native"; import { AppText } from "./AppText"; -import { MaterialIconButton } from "./MaterialIconButton"; +import { IconButton } from "./IconButton"; import type { NumberFieldProps } from "./NumberField"; export function NumberField(props: NumberFieldProps) { @@ -19,7 +19,7 @@ export function NumberField(props: NumberFieldProps) { className="absolute inset-x-0 rounded-full bg-subtle" style={{ height: 32 }} /> - {props.value} - = props.max} diff --git a/apps/mobile/src/components/ScreenHeader.android.tsx b/apps/mobile/src/components/ScreenHeader.android.tsx index 333afbce7ccc..42620d39aa3c 100644 --- a/apps/mobile/src/components/ScreenHeader.android.tsx +++ b/apps/mobile/src/components/ScreenHeader.android.tsx @@ -15,7 +15,7 @@ import { AndroidScreenHeader } from "./AndroidScreenHeader"; import { ScreenHeaderButton } from "./ScreenHeaderButton.android"; import { SymbolView } from "./AppSymbol"; import { ControlPillMenu } from "./ControlPill"; -import { MaterialSearchField } from "./MaterialSearchField"; +import { SearchField } from "./SearchField"; import { androidHeaderMenuActions, findHeaderMenuAction } from "./headerMenu.android"; import type { ScreenHeaderProps } from "./ScreenHeader.types"; import { useAndroidControlSizing } from "./useAndroidControlSizing"; @@ -208,7 +208,7 @@ export function ScreenHeader(props: ScreenHeaderProps) { icon="arrow.left" onPress={closeSearch} /> - ; readonly accessibilityLabel: string; @@ -20,7 +12,17 @@ export function MaterialSearchField({ readonly placeholder: string; readonly value: string; readonly onChangeText: (value: string) => void; -}) { +} + +export function SearchField({ + inputRef, + autoFocus = true, + accessibilityLabel, + clearAccessibilityLabel, + placeholder, + value, + onChangeText, +}: SearchFieldProps) { const { scale, mediumIconSize } = useAndroidControlSizing(); return ( )} - props.onReconnect(props.environment.environmentId)} /> -