tightening up styling

This commit is contained in:
Ryan Skinner
2024-05-22 15:34:01 -04:00
parent 0ee601a022
commit b25e1d5ece
+35 -21
View File
@@ -965,7 +965,7 @@ function SearchHistory({
onRemoveItemClick: (item: string) => void onRemoveItemClick: (item: string) => void
onRemoveProfileClick: (profile: AppBskyActorDefs.ProfileViewBasic) => void onRemoveProfileClick: (profile: AppBskyActorDefs.ProfileViewBasic) => void
}) { }) {
const {isTabletOrDesktop} = useWebMediaQueries() const {isTabletOrDesktop, isMobile} = useWebMediaQueries()
const pal = usePalette('default') const pal = usePalette('default')
return ( return (
@@ -976,20 +976,30 @@ function SearchHistory({
height: isWeb ? '100vh' : undefined, height: isWeb ? '100vh' : undefined,
}}> }}>
<View style={styles.searchHistoryContainer}> <View style={styles.searchHistoryContainer}>
{(searchHistory.length > 0 || selectedProfiles.length > 0) && (
<Text style={[pal.text, styles.searchHistoryTitle]}>
<Trans>Recent Searches</Trans>
</Text>
)}
{selectedProfiles.length > 0 && ( {selectedProfiles.length > 0 && (
<View style={styles.selectedProfilesContainer}> <View
<Text style={[pal.text, styles.searchHistoryTitle]}> style={[
<Trans>Recent Profiles</Trans> styles.selectedProfilesContainer,
</Text> isMobile && styles.selectedProfilesContainerMobile,
]}>
<ScrollView <ScrollView
horizontal={true} horizontal={true}
style={styles.profilesRow} style={styles.profilesRow}
contentContainerStyle={{ contentContainerStyle={{
borderWidth: 0, borderWidth: 0,
justifyContent: 'space-between',
}}> }}>
{selectedProfiles.slice(0, 5).map((profile, index) => ( {selectedProfiles.slice(0, 5).map((profile, index) => (
<View key={index} style={styles.profileItem}> <View
key={index}
style={[
styles.profileItem,
isMobile && styles.profileItemMobile,
]}>
<Pressable <Pressable
accessibilityRole="button" accessibilityRole="button"
onPress={() => onProfileClick(profile)} onPress={() => onProfileClick(profile)}
@@ -1025,9 +1035,6 @@ function SearchHistory({
)} )}
{searchHistory.length > 0 && ( {searchHistory.length > 0 && (
<View style={styles.searchHistoryContent}> <View style={styles.searchHistoryContent}>
<Text style={[pal.text, styles.searchHistoryTitle]}>
<Trans>Recent Searches</Trans>
</Text>
{searchHistory.slice(0, 5).map((historyItem, index) => ( {searchHistory.slice(0, 5).map((historyItem, index) => (
<View <View
key={index} key={index}
@@ -1126,28 +1133,33 @@ const styles = StyleSheet.create({
paddingHorizontal: 12, paddingHorizontal: 12,
}, },
selectedProfilesContainer: { selectedProfilesContainer: {
marginTop: 20, marginTop: 10,
paddingHorizontal: 12, paddingHorizontal: 12,
height: 140, height: 120,
},
selectedProfilesContainerMobile: {
height: 125,
}, },
profilesRow: { profilesRow: {
flexDirection: 'row', flexDirection: 'row',
flexWrap: 'nowrap', flexWrap: 'nowrap',
paddingVertical: 20,
paddingHorizontal: 10,
}, },
profileItem: { profileItem: {
alignItems: 'center', alignItems: 'center',
marginRight: 15, marginRight: 15,
width: 70, width: 98,
},
profileItemMobile: {
marginRight: 10,
width: 90,
}, },
profilePressable: { profilePressable: {
alignItems: 'center', alignItems: 'center',
}, },
profileAvatar: { profileAvatar: {
width: 50, width: 80,
height: 50, height: 80,
borderRadius: 25, borderRadius: 45,
}, },
profileName: { profileName: {
fontSize: 12, fontSize: 12,
@@ -1161,8 +1173,8 @@ const styles = StyleSheet.create({
}, },
profileRemoveBtn: { profileRemoveBtn: {
position: 'absolute', position: 'absolute',
top: -5, top: 0,
right: -5, right: 5,
backgroundColor: 'white', backgroundColor: 'white',
borderRadius: 10, borderRadius: 10,
width: 20, width: 20,
@@ -1171,10 +1183,12 @@ const styles = StyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
}, },
searchHistoryContent: { searchHistoryContent: {
padding: 10, paddingHorizontal: 10,
borderRadius: 8, borderRadius: 8,
}, },
searchHistoryTitle: { searchHistoryTitle: {
fontWeight: 'bold', fontWeight: 'bold',
paddingVertical: 12,
paddingHorizontal: 10,
}, },
}) })