-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
react: update connected account modal to show user tag and profile pi…
…c when available
- Loading branch information
1 parent
0412906
commit 7262679
Showing
5 changed files
with
57 additions
and
13 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,5 @@ | ||
--- | ||
"@treasure-dev/tdk-react": patch | ||
--- | ||
|
||
Updated connected account modal to show user tag and profile pic when available |
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
25 changes: 25 additions & 0 deletions
25
packages/react/src/components/user/UserDisplayName.stories.tsx
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,25 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { UserDisplayName } from "./UserDisplayName"; | ||
|
||
const meta: Meta<typeof UserDisplayName> = { | ||
component: UserDisplayName, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof UserDisplayName>; | ||
|
||
export const Default: Story = { | ||
args: { | ||
address: "0x73239D66c237D5923a7DF2D4E1E59fB7432c7826", | ||
className: "tdk-bg-black tdk-p-2", | ||
}, | ||
}; | ||
|
||
export const WithTag: Story = { | ||
args: { | ||
address: "0x73239D66c237D5923a7DF2D4E1E59fB7432c7826", | ||
tag: "rappzula", | ||
className: "tdk-bg-black tdk-p-2", | ||
}, | ||
}; |
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,19 @@ | ||
import { shortenAddress } from "thirdweb/utils"; | ||
|
||
import { TreasureSparklesIcon } from "../../icons/TreasureSparklesIcon"; | ||
import { cn } from "../../utils/classnames"; | ||
|
||
type Props = { | ||
address: string; | ||
tag?: string | null; | ||
className?: string; | ||
}; | ||
|
||
export const UserDisplayName = ({ address, tag, className }: Props) => ( | ||
<span className={cn("tdk-flex tdk-items-center tdk-gap-1", className)}> | ||
<TreasureSparklesIcon className="tdk-w-3.5 tdk-h-3.5 tdk-text-ruby" /> | ||
<span className={cn("tdk-text-cream", !!tag && "tdk-font-medium")}> | ||
{tag ?? shortenAddress(address)} | ||
</span> | ||
</span> | ||
); |
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