Chap05 -> Using route parameter -> Creating an AnswerList component -> 4 & 5 & 6: Created Answer component

Chap05
Jason Zhu 2022-03-30 15:07:46 +11:00
parent 943e22ffdb
commit a2d892793c
1 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,38 @@
/** @jsxImportSource @emotion/react */
import { css } from '@emotion/react';
import React from 'react';
import { AnswerData } from './QuestionsData';
import { gray3 } from './Styles';
interface Props {
data: AnswerData;
}
export const Answer = ({ data }: Props) => (
<div
css={`
padding: 10px 0px;
`}
>
<div
css={css`
padding: 10px 0px;
font-size: 13px;
`}
>
{data.content}
</div>
<div
css={css`
font-size: 12px;
font-style: italic;
color: ${gray3};
`}
>
{`Answered by ${
data.userName
} on ${data.created.toLocaleDateString()} ${data.created.toLocaleTimeString()}`}
</div>
</div>
);