Compare commits
2 Commits
055f653476
...
4a04834929
Author | SHA1 | Date |
---|---|---|
Jason Zhu | 4a04834929 | |
Jason Zhu | 1292870db9 |
|
@ -1,3 +1,7 @@
|
||||||
|
/** @jsxImportSource @emotion/react */
|
||||||
|
import { css } from '@emotion/react';
|
||||||
|
import { gray2, gray3 } from './Styles';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { QuestionData } from './QuestionsData';
|
import { QuestionData } from './QuestionsData';
|
||||||
|
|
||||||
|
@ -8,15 +12,34 @@ interface Props {
|
||||||
|
|
||||||
export const Question = ({ data, showContent }: Props) => (
|
export const Question = ({ data, showContent }: Props) => (
|
||||||
<div>
|
<div>
|
||||||
<div>{data.title}</div>
|
<div
|
||||||
|
css={css`
|
||||||
|
padding: 10px 0px;
|
||||||
|
font-size: 19px;
|
||||||
|
`}
|
||||||
|
>
|
||||||
|
{data.title}
|
||||||
|
</div>
|
||||||
{showContent && (
|
{showContent && (
|
||||||
<div>
|
<div
|
||||||
|
css={css`
|
||||||
|
padding-bottom: 10px;
|
||||||
|
font-size: 15px;
|
||||||
|
color: ${gray2};
|
||||||
|
`}
|
||||||
|
>
|
||||||
{data.content.length > 50
|
{data.content.length > 50
|
||||||
? `${data.content.substring(0, 50)}`
|
? `${data.content.substring(0, 50)}`
|
||||||
: data.content}
|
: data.content}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div>
|
<div
|
||||||
|
css={css`
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: italic;
|
||||||
|
color: ${gray3};
|
||||||
|
`}
|
||||||
|
>
|
||||||
{`Ask by ${
|
{`Ask by ${
|
||||||
data.userName
|
data.userName
|
||||||
} on ${data.created.toLocaleDateString()} ${data.created.toLocaleTimeString()}`}
|
} on ${data.created.toLocaleDateString()} ${data.created.toLocaleTimeString()}`}
|
||||||
|
|
|
@ -1,15 +1,38 @@
|
||||||
|
/** @jsxImportSource @emotion/react */
|
||||||
|
import { css } from '@emotion/react';
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Question } from './Question';
|
import { Question } from './Question';
|
||||||
import { QuestionData } from './QuestionsData';
|
import { QuestionData } from './QuestionsData';
|
||||||
|
import { accent2, gray5 } from './Styles';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
data: QuestionData[];
|
data: QuestionData[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QuestionList = ({ data }: Props) => (
|
export const QuestionList = ({ data }: Props) => (
|
||||||
<ul>
|
<ul
|
||||||
|
css={css`
|
||||||
|
list-style: none;
|
||||||
|
margin: 10px 0 0 0;
|
||||||
|
padding: 0px 20px;
|
||||||
|
background-color: #fff;
|
||||||
|
border-bottom-left-radius: 4px;
|
||||||
|
border-bottom-right-radius: 4px;
|
||||||
|
border-top: 3px solid ${accent2};
|
||||||
|
box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.16);
|
||||||
|
`}
|
||||||
|
>
|
||||||
{data.map((question) => (
|
{data.map((question) => (
|
||||||
<li key={question.questionId}>
|
<li
|
||||||
|
key={question.questionId}
|
||||||
|
css={css`
|
||||||
|
border-top: 1px solid ${gray5};
|
||||||
|
:first-of-type {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
>
|
||||||
<Question data={question} />
|
<Question data={question} />
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|
Loading…
Reference in New Issue