-
Notifications
You must be signed in to change notification settings - Fork 507
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tooltips, refactor other page nav, bump SDK, tweaks (#1096)
- Loading branch information
Showing
22 changed files
with
1,780 additions
and
1,493 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import { useContext } from 'react'; | ||
import { StyleSheet, View, ViewStyle } from 'react-native'; | ||
|
||
import { FILTER_PLATFORMS } from './helpers'; | ||
import { colors, darkColors, P } from '../../common/styleguide'; | ||
import CustomAppearanceContext from '../../context/CustomAppearanceContext'; | ||
import { Query } from '../../types'; | ||
import { Button } from '../Button'; | ||
import { Filter as FilterIcon } from '../Icons'; | ||
|
||
type FilterButtonProps = { | ||
query: Query; | ||
onPress: () => void; | ||
isFilterVisible: boolean; | ||
style?: ViewStyle; | ||
}; | ||
|
||
export const FilterButton = ({ isFilterVisible, query, onPress, style }: FilterButtonProps) => { | ||
const { isDark } = useContext(CustomAppearanceContext); | ||
|
||
const params = [ | ||
...FILTER_PLATFORMS.map(platform => platform.param), | ||
'hasExample', | ||
'hasImage', | ||
'hasTypes', | ||
'isMaintained', | ||
'isPopular', | ||
'isRecommended', | ||
'wasRecentlyUpdated', | ||
'newArchitecture', | ||
]; | ||
|
||
const filterCount = Object.keys(query).reduce( | ||
(acc, q) => (params.includes(q) ? acc + 1 : acc), | ||
0 | ||
); | ||
|
||
return ( | ||
<Button | ||
onPress={onPress} | ||
style={[ | ||
styles.button, | ||
{ backgroundColor: isDark ? darkColors.border : colors.gray5 }, | ||
isFilterVisible && styles.activeButton, | ||
style, | ||
]}> | ||
<View style={styles.displayHorizontal}> | ||
<View style={styles.iconContainer}> | ||
<FilterIcon | ||
fill={isFilterVisible ? colors.gray7 : filterCount > 0 ? colors.primary : colors.white} | ||
width={14} | ||
height={12} | ||
/> | ||
</View> | ||
<P style={[styles.buttonText, isFilterVisible && styles.activeButtonText]}> | ||
Filters{filterCount > 0 ? `: ${filterCount}` : ''} | ||
</P> | ||
</View> | ||
</Button> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
button: { | ||
height: 24, | ||
paddingHorizontal: 8, | ||
}, | ||
activeButton: { | ||
backgroundColor: colors.primary, | ||
}, | ||
buttonText: { | ||
fontSize: 14, | ||
color: colors.white, | ||
marginLeft: 6, | ||
fontWeight: '500', | ||
userSelect: 'none', | ||
}, | ||
activeButtonText: { | ||
color: colors.gray7, | ||
}, | ||
iconContainer: { | ||
top: 1, | ||
}, | ||
displayHorizontal: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import Link from 'next/link'; | ||
import { Platform, StyleSheet, View } from 'react-native'; | ||
|
||
import { P, colors } from '../../common/styleguide'; | ||
import urlWithQuery from '../../util/urlWithQuery'; | ||
import { CheckBox } from '../CheckBox'; | ||
|
||
export const ToggleLink = ({ query, paramName, title, basePath = '/' }) => { | ||
const isSelected = !!query[paramName]; | ||
|
||
return ( | ||
<Link | ||
href={urlWithQuery(basePath, { | ||
...query, | ||
[paramName]: !isSelected, | ||
offset: null, | ||
})} | ||
style={{ textDecoration: 'none' }}> | ||
<View style={styles.link}> | ||
<CheckBox value={isSelected} color={colors.primaryDark} /> | ||
<P style={{ fontSize: 14 }}>{title}</P> | ||
</View> | ||
</Link> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
link: { | ||
...Platform.select({ | ||
web: { | ||
cursor: 'pointer', | ||
}, | ||
}), | ||
marginRight: 16, | ||
marginVertical: 4, | ||
alignItems: 'center', | ||
flexDirection: 'row', | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export const FILTER_PLATFORMS = [ | ||
{ | ||
param: 'android', | ||
title: 'Android', | ||
}, | ||
{ | ||
param: 'expo', | ||
title: 'Expo Go', | ||
}, | ||
{ | ||
param: 'ios', | ||
title: 'iOS', | ||
}, | ||
{ | ||
param: 'macos', | ||
title: 'macOS', | ||
}, | ||
{ | ||
param: 'tvos', | ||
title: 'tvOS', | ||
}, | ||
{ | ||
param: 'web', | ||
title: 'Web', | ||
}, | ||
{ | ||
param: 'windows', | ||
title: 'Windows', | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.