diff --git a/stylesheets/components/ProfileEditor.scss b/stylesheets/components/ProfileEditor.scss index f4f4f1adb90f..2cb950d36622 100644 --- a/stylesheets/components/ProfileEditor.scss +++ b/stylesheets/components/ProfileEditor.scss @@ -205,13 +205,50 @@ &__username-link { &__tooltip { - padding: 12px; + padding: 0; + background-color: unset; + + --container-padding: 12px; &__container { display: flex; flex-direction: row; + padding: var(--container-padding); + box-shadow: 0 6px 12px rgba(0, 0, 0, 0.12); + border: 1px solid $color-gray-20; + border-radius: inherit; + background-color: $color-gray-02; + transform-origin: 0 0; // needed for react-spring scale animation + @include dark-theme { + background-color: $color-gray-75; + border-color: $color-gray-60; + } } + --direction-multiplier: 1; + &:dir(rtl) { + --direction-multiplier: -1; + } + + &__arrow { + position: absolute; + + // stylelint-disable-next-line declaration-property-value-disallowed-list + transform: translateY(calc(-50% - var(--container-padding))) + translateX( + calc( + var(--direction-multiplier) * (20px - var(--container-padding)) + ) + ) + rotate(45deg); + + width: 14px; + height: 14px; + clip-path: polygon(0 100%, 0 0, 100% 0); + + border: inherit; + background: inherit; + } &__icon { width: 20px; height: 20px; @@ -241,6 +278,7 @@ } p { + @include font-subtitle; max-width: 240px; margin: 0; } @@ -256,6 +294,9 @@ margin: 0; @include color-svg('../images/icons/v3/x/x.svg', $color-gray-45); + @include dark-theme { + @include color-svg('../images/icons/v3/x/x.svg', $color-gray-25); + } } } } diff --git a/ts/components/ProfileEditor.tsx b/ts/components/ProfileEditor.tsx index 194827f144a6..95d14bf1563d 100644 --- a/ts/components/ProfileEditor.tsx +++ b/ts/components/ProfileEditor.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: AGPL-3.0-only import React, { useCallback, useEffect, useRef, useState } from 'react'; +import { useSpring, animated } from '@react-spring/web'; import type { AvatarColorType } from '../types/Colors'; import { AvatarColors } from '../types/Colors'; @@ -45,6 +46,7 @@ import { import { isWhitespace, trim } from '../util/whitespaceStringUtil'; import { UserText } from './UserText'; import { Tooltip, TooltipPlacement } from './Tooltip'; +import { offsetDistanceModifier } from '../util/popperUtil'; export enum EditState { None = 'None', @@ -625,34 +627,13 @@ export function ProfileEditor({ ); if (!hasCompletedUsernameLinkOnboarding) { - const tooltip = ( -
-
- -
-

- {i18n('icu:ProfileEditor__username-link__tooltip__title')} -

-

{i18n('icu:ProfileEditor__username-link__tooltip__body')}

-
- -
- ); maybeUsernameLinkRow = ( - {maybeUsernameLinkRow} - + ); } } @@ -834,3 +815,55 @@ export function ProfileEditor({ ); } + +function UsernameLinkTooltip({ + handleClose, + children, + i18n, +}: { + handleClose: VoidFunction; + children: React.ReactNode; + i18n: LocalizerType; +}) { + const animatedStyles = useSpring({ + from: { opacity: 0, scale: 0.25 }, + to: { opacity: 1, scale: 1 }, + config: { mass: 1, tension: 280, friction: 25 }, + delay: 200, + }); + const tooltip = ( + +
+ +
+

{i18n('icu:ProfileEditor__username-link__tooltip__title')}

+

{i18n('icu:ProfileEditor__username-link__tooltip__body')}

+
+ +