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

Chap05
Jason Zhu 2022-03-30 14:58:26 +11:00
parent 40b20ae730
commit 943e22ffdb
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>;
};