mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 12:19:08 +01:00
feat(poll): changed ui of poll results (#328)
This commit is contained in:
parent
2672af671c
commit
4d23fb1467
1 changed files with 9 additions and 8 deletions
|
@ -42,15 +42,16 @@ async function vote(e: Event) {
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div v-for="(option, index) of poll.options" :key="index" flex justify-between p-1 relative :style="{ '--bar-width': toPercentage((option.votesCount || 0) / poll.votesCount) }">
|
<div v-for="(option, index) of poll.options" :key="index" py-1 relative :style="{ '--bar-width': toPercentage((option.votesCount || 0) / poll.votesCount) }">
|
||||||
<div absolute top-0 left-0 bottom-0 bg-primary-active rounded-l-sm rounded-r-lg h-full class="w-[var(--bar-width)]" />
|
<div flex justify-between pb-2 w-full>
|
||||||
<div z-1 flex items-center gap-1 px-1 text-inverted>
|
<span inline-flex align-items>
|
||||||
{{ option.title }}
|
{{ option.title }}
|
||||||
|
<span v-if="poll.voted && poll.ownVotes?.includes(index)" ml-2 mt-1 inline-block i-ri:checkbox-circle-line />
|
||||||
<div v-if="poll.voted && poll.ownVotes?.includes(index)" i-ri:checkbox-circle-line />
|
</span>
|
||||||
|
<span text-primary-active> {{ poll.votesCount ? toPercentage((option.votesCount || 0) / (poll.votesCount)) : '0%' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div z-1>
|
<div class="bg-gray/40" rounded-l-sm rounded-r-lg h-5px w-full>
|
||||||
{{ poll.votesCount ? toPercentage((option.votesCount || 0) / (poll.votesCount)) : '0%' }}
|
<div bg-primary-active h-full class="w-[var(--bar-width)]" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue