xref: /MusicFree/src/pages/home/components/navBar.tsx (revision b4c389f44ac4dad056e7314478fadd2eca82a4b1)
1*b4c389f4Smaotoumaoimport {ROUTE_PATH} from '@/core/router';
2bf6e62f2S猫头猫import {useNavigation} from '@react-navigation/native';
3ec26b768S猫头猫import React from 'react';
41119c2eaS猫头猫import {Pressable, StyleSheet, View} from 'react-native';
5bf6e62f2S猫头猫import rpx from '@/utils/rpx';
6ec26b768S猫头猫import useColors from '@/hooks/useColors';
719dc08ecS猫头猫import ThemeText from '@/components/base/themeText';
808a8e62cS猫头猫import Color from 'color';
91119c2eaS猫头猫import IconButton from '@/components/base/iconButton';
105589cdf3S猫头猫import Icon from '@/components/base/icon.tsx';
11bf6e62f2S猫头猫
12bf6e62f2S猫头猫// todo icon: = musicFree(引入自定义字体 居中) search
13bf6e62f2S猫头猫export default function NavBar() {
14bf6e62f2S猫头猫    const navigation = useNavigation<any>();
15ec26b768S猫头猫    const colors = useColors();
16bf6e62f2S猫头猫    return (
171119c2eaS猫头猫        <View style={styles.appbar}>
181119c2eaS猫头猫            <IconButton
1995270b83S猫头猫                accessibilityLabel="打开侧边栏"
205589cdf3S猫头猫                name="bars-3"
211119c2eaS猫头猫                style={styles.menu}
22bf6e62f2S猫头猫                color={colors.text}
23bf6e62f2S猫头猫                onPress={() => {
24bf6e62f2S猫头猫                    navigation?.openDrawer();
25bf6e62f2S猫头猫                }}
26bf6e62f2S猫头猫            />
271119c2eaS猫头猫
28bf6e62f2S猫头猫            <Pressable
29ec26b768S猫头猫                style={[
301119c2eaS猫头猫                    styles.searchBar,
31ec26b768S猫头猫                    {
32e650bfb3S猫头猫                        backgroundColor: colors.placeholder,
33ec26b768S猫头猫                    },
34ec26b768S猫头猫                ]}
359dc4d3f3S猫头猫                accessible
369dc4d3f3S猫头猫                accessibilityLabel="点击这里开始搜索"
37bf6e62f2S猫头猫                onPress={() => {
38bf6e62f2S猫头猫                    navigation.navigate(ROUTE_PATH.SEARCH_PAGE);
39bf6e62f2S猫头猫                }}>
40bf6e62f2S猫头猫                <Icon
419dc4d3f3S猫头猫                    accessible={false}
425589cdf3S猫头猫                    name="magnifying-glass"
4398547244S猫头猫                    size={rpx(32)}
446cfecf1cS猫头猫                    color={Color(colors.text).alpha(0.6).toString()}
454060c00aS猫头猫                />
464060c00aS猫头猫                <ThemeText
479dc4d3f3S猫头猫                    accessible={false}
484060c00aS猫头猫                    fontSize="subTitle"
491119c2eaS猫头猫                    style={[styles.text]}>
50ec26b768S猫头猫                    点击这里开始搜索
51ec26b768S猫头猫                </ThemeText>
52bf6e62f2S猫头猫            </Pressable>
531119c2eaS猫头猫        </View>
54bf6e62f2S猫头猫    );
55bf6e62f2S猫头猫}
56bf6e62f2S猫头猫
571119c2eaS猫头猫const styles = StyleSheet.create({
58bf6e62f2S猫头猫    appbar: {
59bf6e62f2S猫头猫        backgroundColor: 'transparent',
60bf6e62f2S猫头猫        shadowColor: 'transparent',
61bf6e62f2S猫头猫        flexDirection: 'row',
621119c2eaS猫头猫        alignItems: 'center',
63c446f2b8S猫头猫        width: '100%',
641119c2eaS猫头猫        height: rpx(88),
65bf6e62f2S猫头猫    },
66bf6e62f2S猫头猫    searchBar: {
67bf6e62f2S猫头猫        marginHorizontal: rpx(24),
68bf6e62f2S猫头猫        flexDirection: 'row',
69bf6e62f2S猫头猫        alignItems: 'center',
70bf6e62f2S猫头猫        flex: 1,
71c4466882S猫头猫        height: '72%',
7298547244S猫头猫        maxHeight: rpx(64),
73ec26b768S猫头猫        borderRadius: rpx(36),
7498547244S猫头猫        paddingHorizontal: rpx(20),
75bf6e62f2S猫头猫    },
76bf6e62f2S猫头猫    text: {
774060c00aS猫头猫        marginLeft: rpx(12),
781119c2eaS猫头猫        opacity: 0.6,
791119c2eaS猫头猫    },
801119c2eaS猫头猫    menu: {
811119c2eaS猫头猫        marginLeft: rpx(24),
82bf6e62f2S猫头猫    },
83bf6e62f2S猫头猫});
84