-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
18 changed files
with
182 additions
and
177 deletions.
There are no files selected for viewing
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
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,36 @@ | ||
import React, {FC} from 'react'; | ||
import AlbumRow from './AlbumRow'; | ||
import {Album} from '../../Types'; | ||
import {useNavigation} from '@react-navigation/native'; | ||
import {useRecoilState} from 'recoil'; | ||
import {contextMenuState} from '../ContextMenu/ContextMenuState'; | ||
|
||
export type AlbumRowWithDataProps = { | ||
album: Album; | ||
}; | ||
|
||
const AlbumRowWithData: FC<AlbumRowWithDataProps> = ({album}) => { | ||
const navigation = useNavigation<any>(); | ||
const [contextMenu, setContextMenu] = useRecoilState(contextMenuState); | ||
const onPressAlbum = () => { | ||
navigation.navigate('AlbumDetails', {album}); | ||
}; | ||
const onContextMenu = (item: Album) => { | ||
setContextMenu({ | ||
...contextMenu, | ||
visible: true, | ||
type: 'album', | ||
item, | ||
}); | ||
}; | ||
|
||
return ( | ||
<AlbumRow | ||
album={album} | ||
onPressAlbum={onPressAlbum} | ||
onPressContextMenu={onContextMenu} | ||
/> | ||
); | ||
}; | ||
|
||
export default AlbumRowWithData; |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import AlbumRow from './AlbumRow'; | ||
import AlbumRow from './AlbumRowWithData'; | ||
|
||
export default AlbumRow; |
Empty file.
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,38 @@ | ||
import React, {FC} from 'react'; | ||
import {StyleSheet} from 'react-native'; | ||
import Modal from 'react-native-modal'; | ||
import styled from '@emotion/native'; | ||
|
||
const Container = styled.View` | ||
background-color: #000; | ||
height: 300px; | ||
`; | ||
|
||
export type ContextMenuProps = { | ||
isVisible: boolean; | ||
onClose: () => void; | ||
}; | ||
|
||
const ContextMenu: FC<ContextMenuProps> = ({isVisible, onClose}) => { | ||
return ( | ||
<Modal | ||
isVisible={isVisible} | ||
backdropOpacity={0.03} | ||
onBackdropPress={onClose} | ||
onSwipeComplete={onClose} | ||
swipeThreshold={500} | ||
swipeDirection={['down']} | ||
style={styles.modal}> | ||
<Container></Container> | ||
</Modal> | ||
); | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
modal: { | ||
justifyContent: 'flex-end', | ||
margin: 0, | ||
}, | ||
}); | ||
|
||
export default ContextMenu; |
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,15 @@ | ||
import {atom} from 'recoil'; | ||
import {Album, Track} from '../../Types'; | ||
|
||
export const contextMenuState = atom<{ | ||
visible: boolean; | ||
type: string; | ||
item?: Album | Track; | ||
}>({ | ||
key: 'contextMenuState', | ||
default: { | ||
visible: false, | ||
type: '', | ||
item: undefined, | ||
}, | ||
}); |
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,17 @@ | ||
import React, {FC} from 'react'; | ||
import ContextMenu from './ContextMenu'; | ||
import {useRecoilState} from 'recoil'; | ||
import {contextMenuState} from './ContextMenuState'; | ||
|
||
const ContextMenuWithData: FC = () => { | ||
const [contextMenu, setContextMenu] = useRecoilState(contextMenuState); | ||
const onClose = () => { | ||
setContextMenu({ | ||
...contextMenu, | ||
visible: false, | ||
}); | ||
}; | ||
return <ContextMenu isVisible={contextMenu.visible} onClose={onClose} />; | ||
}; | ||
|
||
export default ContextMenuWithData; |
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,3 @@ | ||
import ContextMenu from './ContextMenuWithData'; | ||
|
||
export default ContextMenu; |
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.