-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enhancement: add account colour to recipient input (#5211)
* enhancement: add account colour to recipient input * refactor: circle into ColoredCircle component Co-authored-by: Mark Nardi <mark.nardi@iota.org>
- Loading branch information
1 parent
a2fdb3f
commit 4db5079
Showing
8 changed files
with
37 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<script lang="typescript"> | ||
export let color = false | ||
export let size: number = 3 | ||
</script> | ||
|
||
<div class="circle self-center rounded-full w-{size} h-{size}" style="--color: {color};" /> | ||
|
||
<style type="text/scss"> | ||
.circle { | ||
background-color: var(--color); | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 2 additions & 29 deletions
31
packages/shared/components/atoms/labels/AccountLabel.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,14 @@ | ||
<script lang="typescript"> | ||
import { IAccountState } from '@core/account' | ||
import { Text, FontWeight } from 'shared/components/' | ||
import { Text, FontWeight, ColoredCircle } from 'shared/components/' | ||
export let account: IAccountState | ||
export let selected = true | ||
</script> | ||
|
||
<div class="flex flex-row items-center space-x-3"> | ||
<div class="circle" style="--account-color: {account?.color};" /> | ||
<ColoredCircle color={account?.color} /> | ||
<Text fontSize="14" fontWeight={FontWeight.semibold} classes={selected ? '' : 'opacity-50'}> | ||
{account?.name} | ||
</Text> | ||
</div> | ||
|
||
<style type="text/scss"> | ||
.circle { | ||
@apply relative; | ||
@apply rounded-full; | ||
@apply w-3; | ||
@apply h-3; | ||
background-color: var(--account-color); | ||
&:after { | ||
@apply absolute; | ||
@apply rounded-full; | ||
@apply w-3; | ||
@apply h-3; | ||
@apply border; | ||
@apply border-solid; | ||
@apply border-gray-700; | ||
@apply bg-transparent; | ||
@apply opacity-10; | ||
@apply top-1/2; | ||
@apply left-1/2; | ||
@apply transform; | ||
@apply -translate-x-1/2; | ||
@apply -translate-y-1/2; | ||
content: ''; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export interface IOption { | ||
id?: number | ||
key?: string | ||
value: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/shared/lib/core/account/utils/getAccountColorById.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { visibleActiveAccounts } from '@core/profile/stores/active-accounts.store' | ||
import { get } from 'svelte/store' | ||
|
||
export function getAccountColorById(id: number): string { | ||
return get(visibleActiveAccounts)?.find((account) => account.index === id)?.color | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters