Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix old items being first #82

Merged
merged 1 commit into from
Feb 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
108 changes: 57 additions & 51 deletions src/components/PollsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,58 +88,64 @@ const PollsList = (): JSX.Element => {
};

const Polls: Function = (): JSX.Element[] => {
return pollList.reverse().map((item: RocketMeetPollFromDB) => (
<div key={item._id}>
<Row>
<Col className="col-11">
<Card bg="dark" text="white" className="pt-4 px-4 my-2 cardindash">
<Row>
<div className="col-8">
<Card.Title className="d-flex flex-row justify-content-between">
<span className="card-title">{item.title}</span>
</Card.Title>
</div>
<div className="col-4">
<Badge
pill
variant={item.open ? "success" : "secondary"}
className="rm-badge-dash"
return pollList
.map((item: RocketMeetPollFromDB) => (
<div key={item._id}>
<Row>
<Col className="col-11">
<Card
bg="dark"
text="white"
className="pt-4 px-4 my-2 cardindash"
>
<Row>
<div className="col-8">
<Card.Title className="d-flex flex-row justify-content-between">
<span className="card-title">{item.title}</span>
</Card.Title>
</div>
<div className="col-4">
<Badge
pill
variant={item.open ? "success" : "secondary"}
className="rm-badge-dash"
>
{item.open ? "open" : "closed"}
</Badge>
</div>
</Row>
<Card.Body className="text-justify">
<a
href={`/poll/${item._id}`}
aria-label="stretched link"
className="stretched-link card-bdy "
>
{item.open ? "open" : "closed"}
</Badge>
</div>
</Row>
<Card.Body className="text-justify">
<a
href={`/poll/${item._id}`}
aria-label="stretched link"
className="stretched-link card-bdy "
>
{item.description}
</a>
</Card.Body>
<Card.Footer className="px-0">
<span className="text-muted">
Created : {dayjs(item.createdAt).format("DD/MM/YYYY")}
</span>
</Card.Footer>
</Card>
</Col>
<Col className="col-1 p-0">
<Button
variant="outline-light"
className="my-2 rm-delete-button"
onClick={(): void => {
setId(item._id);
setModalShow(true);
}}
>
<Trash size="22" color="red " />
</Button>
</Col>
</Row>
</div>
));
{item.description}
</a>
</Card.Body>
<Card.Footer className="px-0">
<span className="text-muted">
Created : {dayjs(item.createdAt).format("DD/MM/YYYY")}
</span>
</Card.Footer>
</Card>
</Col>
<Col className="col-1 p-0">
<Button
variant="outline-light"
className="my-2 rm-delete-button"
onClick={(): void => {
setId(item._id);
setModalShow(true);
}}
>
<Trash size="22" color="red " />
</Button>
</Col>
</Row>
</div>
))
.reverse();
};

const currentDate = Date.now();
Expand Down