From 3ca2bdaa9060276f13a7bc5527fd5924db0227eb Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Mon, 20 Mar 2023 09:28:36 +0000 Subject: [PATCH] Song Card: Rework Layout for responsivity --- front/components/SongCard.tsx | 28 ++++++++++++++-------------- front/components/SongCardGrid.tsx | 11 ++++------- front/views/HomeView.tsx | 3 --- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/front/components/SongCard.tsx b/front/components/SongCard.tsx index 45fdf74..3c25da4 100644 --- a/front/components/SongCard.tsx +++ b/front/components/SongCard.tsx @@ -15,22 +15,22 @@ const SongCard = (props: SongCardProps) => { return ( navigation.navigate('Song', { songId })} > - {[props.songTitle, - - - {songTitle} - - - {artistName} - + + {[props.songTitle, + + + {songTitle} + + + {artistName} + + ) diff --git a/front/components/SongCardGrid.tsx b/front/components/SongCardGrid.tsx index 6408fff..c003c34 100644 --- a/front/components/SongCardGrid.tsx +++ b/front/components/SongCardGrid.tsx @@ -2,23 +2,20 @@ import React from 'react'; import SongCard from './SongCard'; import { FlatGrid } from 'react-native-super-grid'; import { Heading, VStack } from 'native-base'; -import { RequireExactlyOne } from 'type-fest'; type SongCardGrid = { songs: Parameters[0][]; heading?: JSX.Element, -} & RequireExactlyOne<{ - maxItemsPerRow: number, - itemDimension: number, -}> + maxItemsPerRow?: number, + style?: Parameters[0]['additionalRowStyle'] +} const SongCardGrid = (props: SongCardGrid) => { return {props.heading} } spacing={10} diff --git a/front/views/HomeView.tsx b/front/views/HomeView.tsx index 2aa3549..d97f726 100644 --- a/front/views/HomeView.tsx +++ b/front/views/HomeView.tsx @@ -47,7 +47,6 @@ const HomeView = () => { } - itemDimension={screenSize == 'small' ? 200 : 120} songs={nextStepQuery.data?.filter((song) => artistsQueries.find((artistQuery) => artistQuery.data?.id === song.artistId)) .map((song) => ({ albumCover: song.cover, @@ -67,7 +66,6 @@ const HomeView = () => { } - itemDimension={screenSize == 'small' ? 200 : 120} songs={playHistoryQuery.data?.filter((song) => artistsQueries.find((artistQuery) => artistQuery.data?.id === song.artistId)) .map((song) => ({ albumCover: song.cover, @@ -94,7 +92,6 @@ const HomeView = () => { } songs={searchHistoryQuery.data?.filter((song) => artistsQueries.find((artistQuery) => artistQuery.data?.id === song.artistId)) .map((song) => ({