import React from 'react';
import { QuestionData } from './QuestionsData';
interface Props {
data: QuestionData;
showContent?: boolean;
}
export const Question = ({ data, showContent }: Props) => (
{data.title}
{showContent && (
{data.content.length > 50
? `${data.content.substring(0, 50)}`
: data.content}
)}
{`Ask by ${
data.userName
} on ${data.created.toLocaleDateString()} ${data.created.toLocaleTimeString()}`}
);
Question.defaultProps = {
showContent: true,
};