From cddf1b7ff7c995b86c3d84193b93b1d0eff279e2 Mon Sep 17 00:00:00 2001 From: Arthi-chaud Date: Fri, 7 Oct 2022 11:30:56 +0100 Subject: [PATCH] Front: Home View: Song Card Grid --- front/components/SongCard.tsx | 1 + front/components/SongCardGrid.tsx | 26 ++++++++++++++ front/views/HomeView/HomeView.tsx | 60 ++++++++++++++++++++----------- 3 files changed, 66 insertions(+), 21 deletions(-) create mode 100644 front/components/SongCardGrid.tsx diff --git a/front/components/SongCard.tsx b/front/components/SongCard.tsx index 096ef28..7c6409e 100644 --- a/front/components/SongCard.tsx +++ b/front/components/SongCard.tsx @@ -23,6 +23,7 @@ const SongCard = (props: SongCardProps) => { return navigation.navigate('Song', { songId })}> {({ isHovered, isFocused }) => ( [0][]; + maxItemPerRow?: number, + heading?: string +} + +const SongCardGrid = (props: SongCardGrid) => { + return + {props.heading} + } + spacing={20} + /> + + +} + +export default SongCardGrid; \ No newline at end of file diff --git a/front/views/HomeView/HomeView.tsx b/front/views/HomeView/HomeView.tsx index 725c3cd..aa6eabd 100644 --- a/front/views/HomeView/HomeView.tsx +++ b/front/views/HomeView/HomeView.tsx @@ -2,9 +2,11 @@ import React from "react"; import { useQuery } from "react-query"; import API from "../../API"; import LoadingComponent from "../../components/Loading"; -import { Box, ScrollView, useBreakpointValue, Text, VStack, Progress, Button, HStack } from 'native-base'; +import { Box, ScrollView, useBreakpointValue, Text, Heading, VStack, Progress, Button, HStack, useTheme } from 'native-base'; import SongCard from "../../components/SongCard"; import { FlatGrid } from 'react-native-super-grid'; +import { useNavigation } from "@react-navigation/native"; +import SongCardGrid from '../../components/SongCardGrid' const ProgressBar = ({ xp }: { xp: number}) => { const level = Math.floor(xp / 1000); @@ -21,6 +23,8 @@ const ProgressBar = ({ xp }: { xp: number}) => { } const HomeView = () => { + const theme = useTheme(); + const navigation = useNavigation(); const screenSize = useBreakpointValue({ base: 'small', md: "big"}); const flexDirection = useBreakpointValue({ base: 'column', xl: "row"}); const userQuery = useQuery(['user'], () => API.getUserInfo()); @@ -39,28 +43,42 @@ const HomeView = () => { - Passer à l'étape supérieure - - - } - spacing={20} + ({ + albumCover: "", + songTitle: "Song", + artistName: "Artist", + songId: 1 + }))} /> - - - - + + + ({ + albumCover: "", + songTitle: "Song", + artistName: "Artist", + songId: 1 + }))} + /> + - Dernière recherches - - - } - spacing={20} + + + + + + ({ + albumCover: "", + songTitle: "Song", + artistName: "Artist", + songId: 1 + }))} />