Chap05 -> Using route parameters -> Creating an AnswerList component -> 1 & 2 & 3: created AnswerList.tsx
parent
dee956f542
commit
2ea9deeba6
|
@ -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>;
|
||||||
|
};
|
Loading…
Reference in New Issue