Skip to content

Commit

Permalink
Make whole username clickable in UsernameLinkModalBody
Browse files Browse the repository at this point in the history
Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and indutny-signal committed Feb 7, 2024
1 parent e0d9bcd commit 386e8e2
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 18 deletions.
32 changes: 18 additions & 14 deletions stylesheets/components/UsernameLinkModalBody.scss
Expand Up @@ -71,8 +71,6 @@

&__username {
display: flex;
flex-direction: row;
gap: 4px;
justify-content: center;
margin-block: 12px 2px;

Expand All @@ -85,20 +83,26 @@
text-align: center;
}

&__copy {
@include button-reset;
@include button-focus-outline;
&__copy__button {
display: flex;
flex-direction: row;
gap: 4px;

flex-shrink: 0;
margin-top: 2px;
display: inline-block;
width: 16px;
height: 16px;
i {
flex-shrink: 0;
margin-top: 2px;
display: inline-block;
width: 16px;
height: 16px;

@include color-svg(
'../images/icons/v3/copy/copy.svg',
var(--text-color)
);
@include color-svg(
'../images/icons/v3/copy/copy.svg',
var(--text-color)
);
}

@include button-reset;
@include button-focus-outline;
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions ts/components/UsernameLinkModalBody.tsx
Expand Up @@ -808,15 +808,21 @@ export function UsernameLinkModalBody({
>
<div className={`${CLASS}__card__qr`}>{linkImage}</div>
<div className={`${CLASS}__card__username`}>
{!showColors && (
{showColors ? (
<div className={`${CLASS}__card__username__text`}>{username}</div>
) : (
<button
className={classnames(`${CLASS}__card__username__copy`)}
className={`${CLASS}__card__username__copy__button`}
type="button"
onClick={onCopyUsername}
aria-label={i18n('icu:UsernameLinkModalBody__copy')}
/>
>
<i />
<div className={`${CLASS}__card__username__text`}>
{username}
</div>
</button>
)}
<div className={`${CLASS}__card__username__text`}>{username}</div>
</div>
</div>

Expand Down

0 comments on commit 386e8e2

Please sign in to comment.