forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
- remove unnecessary / deprecated code
This commit is contained in:
@@ -9,7 +9,6 @@ export function PollList(
|
||||
userId: string,
|
||||
isVotingClosed: () => boolean,
|
||||
onVote: (optionId: string) => void,
|
||||
onDelete: (optionId: string) => void,
|
||||
): HTMLElement {
|
||||
|
||||
var currentOptions : { [x: string]: any; } | undefined = undefined
|
||||
@@ -112,7 +111,6 @@ export function PollList(
|
||||
totalVotes: total,
|
||||
votingClosed,
|
||||
onVote,
|
||||
onDelete,
|
||||
});
|
||||
const currentEl = list.children[i] as HTMLElement | undefined;
|
||||
|
||||
|
||||
@@ -8,11 +8,10 @@ export interface PollOptionProps {
|
||||
totalVotes: number;
|
||||
votingClosed: boolean;
|
||||
onVote: (id: string) => void;
|
||||
onDelete: (id: string) => void;
|
||||
}
|
||||
|
||||
export function PollOption(props: PollOptionProps): HTMLElement {
|
||||
const { id, name, votes, voted, totalVotes, votingClosed, onVote, onDelete } = props;
|
||||
const { id, name, votes, voted, totalVotes, votingClosed, onVote } = props;
|
||||
|
||||
const row = document.createElement("div");
|
||||
row.className = `poll-option${voted ? " poll-option--voted" : ""}`;
|
||||
@@ -30,17 +29,11 @@ export function PollOption(props: PollOptionProps): HTMLElement {
|
||||
<button class="poll-option__vote-btn" aria-pressed="${voted}"${votingClosed ? " disabled" : ""}>
|
||||
${voted ? "Voted" : "Vote"}
|
||||
</button>
|
||||
<button class="poll-option__delete-btn" aria-label="Remove option">
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2 2l10 10M12 2L2 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
row.querySelector(".poll-option__vote-btn")!.addEventListener("click", () => onVote(id));
|
||||
row.querySelector(".poll-option__delete-btn")!.addEventListener("click", () => onDelete(id));
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user