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

add transparent background option to <Avatar type="account" /> #617

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions .changeset/many-islands-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@status-im/components": patch
---

`<AccountAvatar />` adds option to have transparent background
6 changes: 4 additions & 2 deletions packages/components/src/avatar/avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const meta = {
},

render: props => (
<div className="grid gap-4 theme-yellow">
<div className="grid gap-4">
<h1 className="text-19">User Avatar</h1>
{renderVariant('user')({
...props,
Expand Down Expand Up @@ -100,7 +100,9 @@ const meta = {
<h1 className="text-19">Account Avatar</h1>
{renderVariant('account')({ ...props, emoji: '🍿' })}
<h1 className="text-19">Account Avatar with Opacity</h1>
{renderVariant('account')({ ...props, emoji: '🍿', bgOpacity: '10' })}
{renderVariant('account')({ ...props, emoji: '🍿', bgOpacity: '5' })}
<h1 className="text-19">Account Avatar with Transparent background</h1>
{renderVariant('account')({ ...props, emoji: '🍿', bgOpacity: '0' })}
</div>
),
} satisfies Meta<typeof Avatar>
Expand Down
7 changes: 4 additions & 3 deletions packages/components/src/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type AccountAvatarProps = {
size: '80' | '48' | '32' | '28' | '24' | '20' | '16'
name: string
emoji: string
bgOpacity?: '5' | '10' | '20' | '30' | '40'
bgOpacity?: '0' | '5' | '10' | '20' | '30' | '40' | '100'
}

type IconAvatarProps = {
Expand Down Expand Up @@ -215,15 +215,16 @@ const baseStyles = cva({
'16': 'p-0',
},
background: {
'0': 'bg-customisation-50',
'0': 'bg-transparent',
'5': 'bg-customisation-50/5',
'10': 'bg-customisation-50/10',
'20': 'bg-customisation-50/20',
'30': 'bg-customisation-50/30',
'40': 'bg-customisation-50/40',
'100': 'bg-customisation-50',
},
felicio marked this conversation as resolved.
Show resolved Hide resolved
},
defaultVariants: {
background: '0',
background: '100',
},
})
Loading