Integrate the shell into the design system

zio/stable
Paul Frazee 2022-12-30 12:49:07 -06:00
parent efaf8a54b8
commit 5e07b5bbc3
1 changed files with 16 additions and 49 deletions

View File

@ -43,6 +43,8 @@ import {
BellIconSolid, BellIconSolid,
} from '../../lib/icons' } from '../../lib/icons'
import {useAnimatedValue} from '../../lib/hooks/useAnimatedValue' import {useAnimatedValue} from '../../lib/hooks/useAnimatedValue'
import {useTheme} from '../../lib/ThemeContext'
import {usePalette} from '../../lib/hooks/usePalette'
const Btn = ({ const Btn = ({
icon, icon,
@ -64,6 +66,7 @@ const Btn = ({
onPress?: (event: GestureResponderEvent) => void onPress?: (event: GestureResponderEvent) => void
onLongPress?: (event: GestureResponderEvent) => void onLongPress?: (event: GestureResponderEvent) => void
}) => { }) => {
const pal = usePalette('default')
let size = 24 let size = 24
let addedStyles let addedStyles
let IconEl let IconEl
@ -105,12 +108,18 @@ const Btn = ({
<Text style={styles.tabCountLabel}>{tabCount}</Text> <Text style={styles.tabCountLabel}>{tabCount}</Text>
</View> </View>
) : undefined} ) : undefined}
<IconEl size={size} style={[styles.ctrlIcon, addedStyles]} icon={icon} /> <IconEl
size={size}
style={[styles.ctrlIcon, pal.text, addedStyles]}
icon={icon}
/>
</TouchableOpacity> </TouchableOpacity>
) )
} }
export const MobileShell: React.FC = observer(() => { export const MobileShell: React.FC = observer(() => {
const theme = useTheme()
const pal = usePalette('default')
const store = useStores() const store = useStores()
const [isTabsSelectorActive, setTabsSelectorActive] = useState(false) const [isTabsSelectorActive, setTabsSelectorActive] = useState(false)
const scrollElRef = useRef<FlatList | undefined>() const scrollElRef = useRef<FlatList | undefined>()
@ -336,6 +345,9 @@ export const MobileShell: React.FC = observer(() => {
const isAtHome = store.nav.tab.current.url === '/' const isAtHome = store.nav.tab.current.url === '/'
const isAtNotifications = store.nav.tab.current.url === '/notifications' const isAtNotifications = store.nav.tab.current.url === '/notifications'
const screenBg = {
backgroundColor: theme.colorScheme === 'dark' ? colors.black : colors.gray1,
}
return ( return (
<View style={styles.outerContainer}> <View style={styles.outerContainer}>
<View style={[styles.innerContainer, {paddingTop: safeAreaInsets.top}]}> <View style={[styles.innerContainer, {paddingTop: safeAreaInsets.top}]}>
@ -373,7 +385,7 @@ export const MobileShell: React.FC = observer(() => {
<Animated.View <Animated.View
style={[ style={[
s.flex1, s.flex1,
styles.screen, screenBg,
current current
? [ ? [
swipeTransform, swipeTransform,
@ -425,6 +437,8 @@ export const MobileShell: React.FC = observer(() => {
<Animated.View <Animated.View
style={[ style={[
styles.bottomBar, styles.bottomBar,
pal.view,
pal.border,
{paddingBottom: clamp(safeAreaInsets.bottom, 15, 30)}, {paddingBottom: clamp(safeAreaInsets.bottom, 15, 30)},
footerMinimalShellTransform, footerMinimalShellTransform,
]}> ]}>
@ -520,9 +534,6 @@ const styles = StyleSheet.create({
screenContainer: { screenContainer: {
flex: 1, flex: 1,
}, },
screen: {
backgroundColor: colors.gray1,
},
screenMask: { screenMask: {
position: 'absolute', position: 'absolute',
top: 0, top: 0,
@ -550,56 +561,13 @@ const styles = StyleSheet.create({
topBarProtectorDark: { topBarProtectorDark: {
backgroundColor: colors.black, backgroundColor: colors.black,
}, },
avi: {
width: 34,
height: 34,
marginRight: 8,
borderRadius: 17,
},
location: {
flex: 1,
flexDirection: 'row',
borderRadius: 6,
paddingLeft: 12,
paddingRight: 6,
paddingTop: 9,
paddingBottom: 9,
backgroundColor: colors.gray1,
},
locationIcon: {
color: colors.gray5,
marginTop: 3,
marginRight: 6,
},
locationIconNudgeUp: {
marginTop: 2,
},
locationIconLight: {
color: colors.gray5,
marginTop: 2,
marginRight: 8,
},
locationText: {
color: colors.black,
},
locationTextLight: {
color: colors.gray4,
},
topBarBtn: {
marginLeft: 8,
justifyContent: 'center',
borderRadius: 6,
paddingHorizontal: 6,
},
bottomBar: { bottomBar: {
position: 'absolute', position: 'absolute',
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
flexDirection: 'row', flexDirection: 'row',
backgroundColor: colors.white,
borderTopWidth: 1, borderTopWidth: 1,
borderTopColor: colors.gray2,
paddingLeft: 5, paddingLeft: 5,
paddingRight: 15, paddingRight: 15,
}, },
@ -633,7 +601,6 @@ const styles = StyleSheet.create({
color: colors.black, color: colors.black,
}, },
ctrlIcon: { ctrlIcon: {
color: colors.black,
marginLeft: 'auto', marginLeft: 'auto',
marginRight: 'auto', marginRight: 'auto',
}, },