From 70c2b9b0a9d554d66a4f9bab68f0a869b2f8f2f6 Mon Sep 17 00:00:00 2001 From: Liam Stevens <8955671+liamstevens111@users.noreply.github.com> Date: Fri, 10 Mar 2023 15:55:56 +0700 Subject: [PATCH] [#26] SurveyList to only display a single Survey depending on position --- src/components/Survey/index.tsx | 4 ++-- src/components/SurveyList/index.tsx | 20 +++++++++++--------- src/screens/Home/index.tsx | 6 +++++- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/components/Survey/index.tsx b/src/components/Survey/index.tsx index 2b77c7f..ed3d65d 100644 --- a/src/components/Survey/index.tsx +++ b/src/components/Survey/index.tsx @@ -8,8 +8,8 @@ function Survey({ title, description, coverImageUrl }: SurveyProps) { return ( <> cover -

{title}

-

{description}

+

{title}

+

{description}

); } diff --git a/src/components/SurveyList/index.tsx b/src/components/SurveyList/index.tsx index b9131a5..d005467 100644 --- a/src/components/SurveyList/index.tsx +++ b/src/components/SurveyList/index.tsx @@ -1,19 +1,21 @@ +import { useState } from 'react'; + +import Button from 'components/Button'; import SurveyComponent from 'components/Survey'; import { Survey } from 'types/Survey'; type SurveyListProps = { surveys: Survey[] }; function SurveyList({ surveys }: SurveyListProps) { + const [index, setIndex] = useState(0); + return ( -
- {surveys.map((survey) => { - return ( -
  • - -
  • - ); - })} -
    + <> + + + {/* TODO: For testing */} +