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

refactor: rebrand ProposalAnswer #1972

Merged
merged 4 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
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
67 changes: 25 additions & 42 deletions packages/desktop/components/ProposalAnswer.svelte
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
<script lang="ts">
import { Answer, EventStatus } from '@iota/sdk/out/types'

import { Icon, Text } from '@ui'

import { darkMode } from '@core/app/stores'

import { Icon as IconEnum } from '@auxiliary/icon'
import { Indicator, TooltipIcon } from '@bloomwalletio/ui'
import { FontWeight } from '@ui/enums'
import { Icon, IconName, Indicator, Text, TooltipIcon } from '@bloomwalletio/ui'

export let onAnswerClick: () => void

Expand Down Expand Up @@ -49,7 +42,6 @@
<button
type="button"
class="proposal-answer"
class:dark={$darkMode}
class:disabled
class:hidden={isSelected || isWinner ? false : hidden}
class:voted={isVotedFor}
Expand All @@ -63,10 +55,8 @@
{#if answerIndex !== undefined}
{#if isVotedFor}
<status-icon class="flex justify-center items-center w-5 h-5">
{#if proposalStatus === EventStatus.Ended}
<Icon icon={IconEnum.Voted} width={20} height={20} />
{:else if proposalStatus === EventStatus.Commencing}
<Icon icon={IconEnum.History} width={20} height={20} />
{#if proposalStatus === EventStatus.Ended || proposalStatus === EventStatus.Commencing}
<Icon name={IconName.ReceiptCheck} size="sm" textColor={isWinner ? 'invert' : 'brand'} />
{:else if proposalStatus === EventStatus.Holding}
<Indicator size="sm" ping />
{/if}
Expand All @@ -75,21 +65,18 @@
<answer-index>{answerIndex + 1}</answer-index>
{/if}
{/if}
<Text fontWeight={FontWeight.medium} classes="w-full {truncate ? 'truncate' : ''}">{answer.text}</Text>
<Text
fontWeight={isSelected || isVotedFor ? 'semibold' : 'medium'}
textColor={isSelected || isVotedFor ? 'primary' : 'secondary'}
truncate>{answer.text}</Text
>
</div>
<div class="flex items-center space-x-1.5">
{#if isWinner}
<Icon icon={IconEnum.Trophy} />
<Icon name={IconName.Trophy} size="xs" />
{/if}
{#if percentage}
<Text
smaller
fontWeight={FontWeight.medium}
classes="h-3 ml-auto text-gray-700 dark:text-gray-500"
overrideColor
>
{percentage}
</Text>
<Text type="sm" textColor="secondary">{percentage}</Text>
{/if}
{#if answer.additionalInfo}
<div class="w-3 h-3">
Expand All @@ -101,37 +88,33 @@

<style lang="scss">
.proposal-answer {
@apply rounded-md border border-solid border-gray-200;
@apply rounded-lg border border-solid border-stroke dark:border-stroke-dark;
@apply relative hidden items-center justify-between p-3 overflow-hidden;
> * {
z-index: 2;
}

&::after {
@apply z-10 absolute inline-block h-full -ml-3 mr-auto;
@apply rounded-l-md bg-gray-100;
@apply rounded-l-md bg-surface-2;
content: '';
width: var(--percentage);
z-index: 1;
}

&:not(.disabled):hover {
@apply border-blue-500;
@apply border-brand;
}

&:not(.hidden) {
@apply flex;
}

&:not(.winner) status-icon :global(svg) {
@apply text-blue-500;
}

&.selected {
@apply border-blue-500;
@apply border-brand;

answer-index {
@apply bg-blue-500 text-white;
@apply bg-brand text-white;
}
}

Expand All @@ -146,34 +129,34 @@
}

&.winner {
@apply bg-blue-500;
@apply bg-text-brand-dark border-brand;

&::after {
@apply bg-blue-600;
@apply bg-brand;
}

answer-index {
@apply bg-blue-600 text-white;
@apply bg-surface-brand text-white;
}

:global(*) {
@apply text-white;
}
}

&.dark:not(.selected) {
@apply border-transparent;
&:not(.selected):not(.winner) {
@apply dark:border-transparent;
}

&.dark:not(.winner) {
@apply bg-gray-900;
&:not(.winner) {
@apply dark:bg-surface-dark;

&::after {
@apply bg-gray-950;
@apply dark:bg-surface-dark;
}

answer-index {
@apply bg-gray-900 border-gray-800;
@apply dark:bg-surface-dark dark:border-stroke-dark;
}
}

Expand All @@ -183,7 +166,7 @@

answer-index {
@apply flex items-center justify-center h-5 w-5 bg-white;
@apply border border-solid border-gray-200;
@apply border border-solid border-stroke rounded-sm;
@apply font-bold text-12 text-gray-500;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "Bloom Labs Ltd <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
"@bloomwalletio/ui": "0.20.3",
"@bloomwalletio/ui": "0.20.4",
"@ethereumjs/rlp": "4.0.1",
"@ethereumjs/tx": "5.2.1",
"@ethereumjs/util": "9.0.2",
Expand Down
9 changes: 5 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,16 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@bloomwalletio/[email protected].3":
version "0.20.3"
resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.20.3/4ff384a8f0e32eb1d7ac72ecccdeabd5670030f8#4ff384a8f0e32eb1d7ac72ecccdeabd5670030f8"
integrity sha512-QEHsdq9isrs+m6osZRdafRFgac5k4Zcxn5AtQAwFjG0za/R6nAlP3zrs6GQpjGwglpIBMjNMMrXtt+8p+StKPQ==
"@bloomwalletio/[email protected].4":
version "0.20.4"
resolved "https://npm.pkg.github.com/download/@bloomwalletio/ui/0.20.4/55e00320965048d0daef162c9288ac5c75a9da6d#55e00320965048d0daef162c9288ac5c75a9da6d"
integrity sha512-LIwFYpkUrvVJbJMNYucjOFej7+IOYiKswkUNdS1qMFOzAch2zGCr/hDvh31eukhdzEVCCfP5bGLLI2Ck9awKfA==
dependencies:
"@floating-ui/dom" "1.4.3"
"@popperjs/core" "2.11.8"
qrious "4.0.2"
svelte-json-tree "2.1.0"
svelte-markdown "0.4.1"
svelty-picker "4.1.4"
tailwind-merge "1.13.2"

Expand Down
Loading