Chap05 -> Using route parameters -> Creating an AnswerList component -> 1 & 2 & 3: created AnswerList.tsx

master
Jason Zhu 2022-03-30 14:58:26 +11:00
parent dee956f542
commit 2ea9deeba6
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import React from 'react';
import { AnswerData } from './QuestionsData';
import { Answer } from './Answer';
import { gray5 } from './Styles';
interface Props {
data: AnswerData[];
}
export const AnswerList = ({ data }: Props) => {
<ul
css={css`
list-style: none;
margin: 10px 0 0 0;
padding: 0;
`}
>
{data.map((answer) => (
<li
css={css`
border-top: 1px solid ${gray5};
`}
key={answer.answertId}
>
<Answer data={answer} />
</li>
))}
</ul>;
};