Merge pull request '(Issue #21): fix unify search bar and icon colors across screens' (#47) from fix/issue-21-search-bar-color into main

Reviewed-on: https://10.10.0.4/AcuPedia/acupedia-mobile-ui/pulls/47
Reviewed-by: Amit Salunke <amit@noreply.localhost>
This commit is contained in:
Amit Salunke 2026-10-05 10:58:14 +00:00
commit 56b4c3b5c5
5 changed files with 117 additions and 8 deletions

View File

@ -1,3 +1,51 @@
import React from "react";
import { TextInput, View } from "react-native";
export function ContentSearchBar({value,onChangeText}:{value:string;onChangeText:(v:string)=>void}){return <View style={{padding:16}}><TextInput value={value} onChangeText={onChangeText} placeholder="Search..." autoCapitalize="none" autoCorrect={false} style={{borderWidth:1,borderRadius:10,padding:10}}/></View>}
import { StyleSheet, TextInput, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { Colors } from "@/theme";
export function ContentSearchBar({
value,
onChangeText,
}: {
value: string;
onChangeText: (v: string) => void;
}) {
return (
<View style={styles.container}>
<View style={styles.searchBox}>
<Ionicons name="search" size={18} color={Colors.primaryDark} />
<TextInput
value={value}
onChangeText={onChangeText}
placeholder="Search…"
placeholderTextColor={Colors.textSecondary}
autoCapitalize="none"
autoCorrect={false}
style={styles.input}
/>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
padding: 16,
},
searchBox: {
flexDirection: "row",
alignItems: "center",
gap: 8,
borderWidth: 1,
borderColor: Colors.border,
borderRadius: 10,
paddingHorizontal: 12,
backgroundColor: "#FAFAFA",
},
input: {
flex: 1,
paddingVertical: 10,
fontSize: 14,
color: Colors.textPrimary,
},
});

View File

@ -1,3 +1,52 @@
import React from "react";
import { TextInput, View } from "react-native";
export function SearchHeader({value,onChangeText,placeholder="Search…"}:{value:string;onChangeText:(v:string)=>void;placeholder?:string}){ return <View style={{padding:12}}><TextInput value={value} onChangeText={onChangeText} placeholder={placeholder} autoCorrect={false} style={{borderWidth:1,borderRadius:10,paddingHorizontal:12,paddingVertical:10,fontSize:16}}/></View>; }
import { StyleSheet, TextInput, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { Colors } from "@/theme";
export function SearchHeader({
value,
onChangeText,
placeholder = "Search…",
}: {
value: string;
onChangeText: (v: string) => void;
placeholder?: string;
}) {
return (
<View style={styles.container}>
<View style={styles.searchBox}>
<Ionicons name="search" size={18} color={Colors.primaryDark} />
<TextInput
value={value}
onChangeText={onChangeText}
placeholder={placeholder}
placeholderTextColor={Colors.textSecondary}
autoCorrect={false}
style={styles.input}
/>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
padding: 12,
},
searchBox: {
flexDirection: "row",
alignItems: "center",
gap: 8,
borderWidth: 1,
borderColor: Colors.border,
borderRadius: 10,
paddingHorizontal: 12,
backgroundColor: "#FAFAFA",
},
input: {
flex: 1,
paddingVertical: 10,
fontSize: 16,
color: Colors.textPrimary,
},
});

View File

@ -100,7 +100,7 @@ export function CollectionTemplateScreen({
}
style={({ pressed }) => [styles.iconButton, pressed && styles.pressed]}
>
<Ionicons name="search" size={21} color={Colors.textPrimary} />
<Ionicons name="search" size={22} color={Colors.primaryDark} />
</Pressable>
{hasSort ? (

View File

@ -18,7 +18,7 @@ export function FacetValueTypeaheadModal({ visible, facet, scope, activeFilters,
const apply = () => { if(!selected.size) return; onApply({ facet_code: facet.code, values:[...selected.keys()], value_mode:"any", display_values:[...selected.values()] }); close(); };
return <Modal visible={visible} animationType="slide" transparent onRequestClose={close}><View style={styles.overlay}><Pressable style={styles.scrim} onPress={close}/><View style={styles.sheet}>
<View style={styles.header}><View><Text style={styles.title}>{facet.label}</Text><Text style={styles.subtitle}>Select {facet.allow_multiple_values ? "one or more values" : "a value"}</Text></View><Pressable onPress={close}><Ionicons name="close" size={22} color={Colors.textPrimary}/></Pressable></View>
<View style={styles.search}><Ionicons name="search" size={18} color={Colors.textSecondary}/><TextInput value={query} onChangeText={setQuery} placeholder={`Search ${facet.label.toLowerCase()}…`} placeholderTextColor={Colors.textSecondary} style={styles.input}/></View>
<View style={styles.search}><Ionicons name="search" size={18} color={Colors.primaryDark}/><TextInput value={query} onChangeText={setQuery} placeholder={`Search ${facet.label.toLowerCase()}…`} placeholderTextColor={Colors.textSecondary} style={styles.input}/></View>
<ScrollView contentContainerStyle={styles.content}>{values.isLoading ? <ActivityIndicator color={Colors.primary}/> : values.data?.items.map((item) => { const active=selected.has(item.value_key); return <Pressable key={item.value_key} style={[styles.valueRow,active&&styles.valueRowActive]} onPress={() => toggle(item.value_key,item.label)}><View style={{flex:1}}><Text style={styles.valueLabel}>{item.label}</Text><Text style={styles.count}>{item.result_count} matching item{item.result_count===1?"":"s"}</Text></View><Ionicons name={active?"checkbox":"square-outline"} size={20} color={active?Colors.primary:Colors.textSecondary}/></Pressable>; })}</ScrollView>
<View style={styles.footer}><Pressable onPress={close} style={styles.cancel}><Text style={styles.cancelText}>Cancel</Text></Pressable><Pressable onPress={apply} style={[styles.apply,!selected.size&&styles.disabled]} disabled={!selected.size}><Text style={styles.applyText}>Add {selected.size ? `(${selected.size})` : ""}</Text></Pressable></View>
</View></View></Modal>;

View File

@ -78,6 +78,7 @@ export default function FacetedSearchScreen({
const [facetPickerVisible, setFacetPickerVisible] = useState(false);
const [selectedFacet, setSelectedFacet] =
useState<SearchFacetDefinition | null>(null);
const [isSearchFocused, setIsSearchFocused] = useState(false);
useEffect(() => {
if (!isModuleMode || !normalizedModuleCode) return;
@ -176,15 +177,22 @@ export default function FacetedSearchScreen({
</Text>
) : null}
<View style={styles.searchBox}>
<View
style={[
styles.searchBox,
isSearchFocused && styles.searchBoxFocused,
]}
>
<Ionicons
name="search"
size={19}
color={Colors.textSecondary}
color={Colors.primaryDark}
/>
<TextInput
value={query}
onChangeText={setQuery}
onFocus={() => setIsSearchFocused(true)}
onBlur={() => setIsSearchFocused(false)}
placeholder={
isModuleMode
? `Search within ${resolvedModuleName}…`
@ -373,6 +381,10 @@ const styles = StyleSheet.create({
paddingHorizontal: 13,
backgroundColor: "#FAFAFA",
},
searchBoxFocused: {
borderColor: Colors.primary,
backgroundColor: "#FFFFFF",
},
input: {
flex: 1,
minHeight: 46,