Merge pull request #375 from rpolley/add-end-date-field-to-projects

Add end date field to projects
This commit is contained in:
Amruth Pillai
2020-11-22 12:00:39 +05:30
committed by GitHub
2 changed files with 42 additions and 21 deletions

View File

@ -52,10 +52,18 @@ const ProjectModal = () => {
<Input
type="date"
label={t('shared.forms.date')}
label={t('shared.forms.startDate')}
placeholder="6th August 208"
{...getFieldProps(formik, schema, 'date')}
/>
<Input
type="date"
label={t('shared.forms.endDate')}
placeholder="6th August 208"
{...getFieldProps(formik, schema, 'endDate')}
/>
<Input
type="textarea"
label={t('shared.forms.summary')}

View File

@ -1,30 +1,43 @@
import React, { memo, useContext } from 'react';
import { useTranslation } from 'react-i18next';
import ReactMarkdown from 'react-markdown';
import PageContext from '../../../contexts/PageContext';
import { formatDate, safetyCheck } from '../../../utils';
import { formatDateRange, safetyCheck } from '../../../utils';
const ProjectItem = ({ item, language }) => (
<div>
<div className="flex justify-between items-center">
<div className="flex flex-col text-left mr-2">
<h6 className="font-semibold">{item.title}</h6>
{item.link && (
<a href={item.link} className="text-xs">
{item.link}
</a>
)}
const ProjectItem = ({ item, language }) => {
const { t } = useTranslation();
return (
<div>
<div className="flex justify-between items-center">
<div className="flex flex-col text-left mr-2">
<h6 className="font-semibold">{item.title}</h6>
{item.link && (
<a href={item.link} className="text-xs">
{item.link}
</a>
)}
</div>
{item.date && (
<h6 className="text-xs font-medium text-right">
(
{formatDateRange(
{
startDate: item.date,
endDate: item.endDate,
language,
},
t,
)}
)
</h6>
)}
</div>
{item.date && (
<h6 className="text-xs font-medium text-right">
{formatDate({ date: item.date, language })}
</h6>
{item.summary && (
<ReactMarkdown className="markdown mt-2 text-sm" source={item.summary} />
)}
</div>
{item.summary && (
<ReactMarkdown className="markdown mt-2 text-sm" source={item.summary} />
)}
</div>
);
);
};
const ProjectsA = () => {
const { data, heading: Heading } = useContext(PageContext);