Skip to content
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
1 change: 1 addition & 0 deletions packages/avatar/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
},
"dependencies": {
"@leafygreen-ui/emotion": "workspace:^",
"@leafygreen-ui/hooks": "workspace:^",
"@leafygreen-ui/icon": "workspace:^",
"@leafygreen-ui/lib": "workspace:^",
"@leafygreen-ui/logo": "workspace:^",
Expand Down
11 changes: 7 additions & 4 deletions packages/avatar/src/AssistantAvatar/AssistantAvatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';

import { useIdAllocator } from '@leafygreen-ui/hooks';
import { createGlyphComponent } from '@leafygreen-ui/icon';
import { useDarkMode } from '@leafygreen-ui/leafygreen-provider';

Expand All @@ -10,8 +11,6 @@ import {
} from './AssistantAvatar.styles';
import { AssistantAvatarProps } from './AssistantAvatar.types';

const GRADIENT_ID = 'sparkle-gradient';

export const AssistantAvatar: React.ComponentType<AssistantAvatarProps> =
createGlyphComponent(
'Sparkle',
Expand All @@ -21,7 +20,11 @@ export const AssistantAvatar: React.ComponentType<AssistantAvatarProps> =
...rest
}: AssistantAvatarProps) => {
const { darkMode, theme } = useDarkMode(darkModeProp);
const fill = disabled ? getDisabledFill(theme) : `url(#${GRADIENT_ID})`;
const gradientId = useIdAllocator({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need a changeset for this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just realized that there is already a changeset. Approving!

prefix: 'lg-assistant_avatar-gradient',
id: rest.id,
});
const fill = disabled ? getDisabledFill(theme) : `url(#${gradientId})`;
const gradientStartColor = getGradientStartColor(darkMode);
const gradientEndColor = getGradientEndColor(darkMode);

Expand All @@ -38,7 +41,7 @@ export const AssistantAvatar: React.ComponentType<AssistantAvatarProps> =
{!disabled && (
<defs>
<linearGradient
id={GRADIENT_ID}
id={gradientId}
x1="3.00005"
y1="3"
x2="12.5001"
Expand Down
3 changes: 3 additions & 0 deletions packages/avatar/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
{
"path": "../emotion"
},
{
"path": "../hooks"
},
{
"path": "../icon"
},
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading