bigbuffet-rw/app/soapbox/features/ui/components/poll-preview.tsx
marcin mikołajczak 81de0014d3 Change ESLint rules, lint
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
2023-02-16 00:12:02 +01:00

37 lines
838 B
TypeScript

import noop from 'lodash/noop';
import React from 'react';
import PollOption from 'soapbox/components/polls/poll-option';
import { Stack } from 'soapbox/components/ui';
import { useAppSelector } from 'soapbox/hooks';
import { Poll as PollEntity } from 'soapbox/types/entities';
interface IPollPreview {
pollId: string
}
const PollPreview: React.FC<IPollPreview> = ({ pollId }) => {
const poll = useAppSelector((state) => state.polls.get(pollId) as PollEntity);
if (!poll) {
return null;
}
return (
<Stack space={2}>
{poll.options.map((option, i) => (
<PollOption
key={i}
poll={poll}
option={option}
index={i}
showResults={false}
active={false}
onToggle={noop}
/>
))}
</Stack>
);
};
export default PollPreview;