-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,152 additions
and
998 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React, { useState } from 'react'; | ||
import { View, TextInput, StyleSheet, TouchableOpacity } from 'react-native'; | ||
import Icon from 'react-native-vector-icons/FontAwesome'; | ||
import { useTheme } from '../../ThemeContext'; | ||
import { searchBar } from '../style/Styles'; | ||
|
||
const SearchBar: React.FC = () => { | ||
const { theme } = useTheme(); | ||
const [query, setQuery] = useState(''); | ||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
const searchMusic = async () => { | ||
if (!query) return; | ||
|
||
setIsLoading(true); | ||
|
||
try { | ||
await new Promise(resolve => setTimeout(resolve, 2000)); | ||
} catch { | ||
setIsLoading(false); | ||
} finally { | ||
setIsLoading(false); | ||
} | ||
}; | ||
|
||
return ( | ||
<View style={[searchBar.searchBar, { backgroundColor: theme.secondary }]}> | ||
<TextInput | ||
style={[searchBar.searchInput, { backgroundColor: theme.third }]} | ||
placeholder="Search" | ||
value={query} | ||
onChangeText={setQuery} | ||
onSubmitEditing={searchMusic} | ||
editable={!isLoading} | ||
/> | ||
<TouchableOpacity style={[searchBar.searchIcon, { backgroundColor: theme.third }]} onPress={searchMusic} disabled={isLoading}> | ||
{isLoading ? ( | ||
<Icon name="hourglass" size={20} color={theme.text} /> | ||
) : ( | ||
<Icon name="search" size={20} color={theme.text} /> | ||
)} | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
export default SearchBar; |
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,29 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet } from 'react-native'; | ||
import SearchBar from './SearchBar'; | ||
import { TouchableOpacity } from 'react-native'; | ||
import { searchBar } from '../style/Styles'; | ||
import Icon from 'react-native-vector-icons/FontAwesome'; | ||
import { useTheme } from '../../ThemeContext'; | ||
|
||
const TopBar: React.FC = () => { | ||
const { theme } = useTheme(); | ||
return ( | ||
<View style={styles.topBar}> | ||
<SearchBar /> | ||
<TouchableOpacity style={[searchBar.searchIcon, { backgroundColor: theme.third }]}> | ||
<Icon name="cog" size={20} color={theme.text} /> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
topBar: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
padding: 10, | ||
}, | ||
}); | ||
|
||
export default TopBar; |
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Oops, something went wrong.