From c085e9aa220eaf76f135684ee6eac9d40f9a7e99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Sun, 26 Nov 2023 17:54:46 +0100 Subject: [PATCH] Tried to make work the golden ratio on phone but failed (it's better tho) --- front/components/V2/GoldenRatio.tsx | 92 +++++------------------ front/components/V2/GoldenRatioPanel.tsx | 60 +++++++++++++++ front/views/V2/DiscoveryView.tsx | 93 +++++++++++++----------- 3 files changed, 132 insertions(+), 113 deletions(-) create mode 100644 front/components/V2/GoldenRatioPanel.tsx diff --git a/front/components/V2/GoldenRatio.tsx b/front/components/V2/GoldenRatio.tsx index f17d5c4..9860fe3 100644 --- a/front/components/V2/GoldenRatio.tsx +++ b/front/components/V2/GoldenRatio.tsx @@ -1,10 +1,8 @@ import React from 'react'; import { View } from 'react-native'; -import { useBreakpointValue } from 'native-base'; +import { useBreakpointValue, Text } from 'native-base'; import HomeMainSongCard from './HomeMainSongCard'; - -const bigSideRatio = 1000; -const smallSideRatio = 618; +import GoldenRatioPanel from './GoldenRatioPanel'; type HomeCardProps = { image: string; @@ -44,80 +42,30 @@ const cards = [ const GoldenRatio = () => { const screenSize = useBreakpointValue({ base: 'small', md: 'big' }); const isPhone = screenSize === 'small'; + // return (r}>test) return ( - } > - } > - - - - } > - - - - } > - - - - - + - - - - - + + + + ); }; diff --git a/front/components/V2/GoldenRatioPanel.tsx b/front/components/V2/GoldenRatioPanel.tsx new file mode 100644 index 0000000..e5b0824 --- /dev/null +++ b/front/components/V2/GoldenRatioPanel.tsx @@ -0,0 +1,60 @@ +import { View, ViewStyle } from 'react-native'; + +const bigSideRatio = 1000; +const smallSideRatio = 618; + +const bigSizePercent = '61.8%'; +const smallSizePercent = '38.2%'; + +type GoldenRatioPanelProps = { + direction: 'row' | 'column' | 'row-reverse' | 'column-reverse'; + header: React.ReactNode; + children: React.ReactNode; + style?: ViewStyle; +}; + +const isVerticalDir = (direction: GoldenRatioPanelProps['direction']) => { + return direction === 'column' || direction === 'column-reverse'; +}; + +const GoldenRatioPanel = ({ direction, header, children, style }: GoldenRatioPanelProps) => { + const firstSizePercent = bigSizePercent; + const secondSizePercent = smallSizePercent; + const isVertical = isVerticalDir(direction); + return ( + + + {header} + + + {children} + + + ); +}; + +GoldenRatioPanel.defaultProps = { + direction: 'row', +}; + +export default GoldenRatioPanel; diff --git a/front/views/V2/DiscoveryView.tsx b/front/views/V2/DiscoveryView.tsx index cc6f94a..e55afb6 100644 --- a/front/views/V2/DiscoveryView.tsx +++ b/front/views/V2/DiscoveryView.tsx @@ -38,17 +38,49 @@ const HomeView = (props: RouteProps<{}>) => { // }, [artistsQueries]); return ( - + // + - + + + {'Suggestions'} + + {songsQuery.isLoading && Loading...} + {/* ) => { gap: 16, }} > - - {'Suggestions'} - - {songsQuery.isLoading && Loading...} - - {songsQuery.data?.map((song) => ( - { - navigation.navigate('Play', { songId: song.id }); - }} - onPlay={() => { - console.log('play'); - }} - /> - ))} - - + {songsQuery.data?.map((song) => ( + { + navigation.navigate('Play', { songId: song.id }); + }} + onPlay={() => { + console.log('play'); + }} + /> + ))} + */} - + + // ); };