Skip to content

chore: add new avatar component #15882

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

Merged
merged 6 commits into from
Dec 17, 2024
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 site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@mui/system": "5.16.7",
"@mui/utils": "5.16.6",
"@mui/x-tree-view": "7.18.0",
"@radix-ui/react-avatar": "1.1.2",
"@radix-ui/react-dialog": "1.1.2",
"@radix-ui/react-label": "2.1.0",
"@radix-ui/react-slider": "1.2.1",
Expand Down
82 changes: 81 additions & 1 deletion site/pnpm-lock.yaml

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

62 changes: 38 additions & 24 deletions site/src/components/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,59 +1,73 @@
import PauseIcon from "@mui/icons-material/PauseOutlined";
import type { Meta, StoryObj } from "@storybook/react";
import { Avatar, AvatarIcon } from "./Avatar";
import { Avatar, AvatarFallback, AvatarImage } from "./Avatar";

const meta: Meta<typeof Avatar> = {
title: "components/Avatar",
component: Avatar,
args: {
children: <AvatarImage src="https://github.com/kylecarbs.png" />,
},
};

export default meta;
type Story = StoryObj<typeof Avatar>;

export const WithLetter: Story = {
args: {
children: "Coder",
},
export const ImageLgSize: Story = {
args: { size: "lg" },
};

export const WithLetterXL = {
export const ImageDefaultSize: Story = {};

export const ImageSmSize: Story = {
args: { size: "sm" },
};

export const IconLgSize: Story = {
args: {
children: "Coder",
size: "xl",
size: "lg",
variant: "icon",
children: (
<AvatarImage src="https://em-content.zobj.net/source/apple/391/billed-cap_1f9e2.png" />
),
},
};

export const WithImage = {
export const IconDefaultSize: Story = {
args: {
src: "https://avatars.githubusercontent.com/u/95932066?s=200&v=4",
variant: "icon",
children: (
<AvatarImage src="https://em-content.zobj.net/source/apple/391/billed-cap_1f9e2.png" />
),
},
};

export const WithImageXL = {
export const IconSmSize: Story = {
args: {
src: "https://avatars.githubusercontent.com/u/95932066?s=200&v=4",
size: "xl",
variant: "icon",
size: "sm",
children: (
<AvatarImage src="https://em-content.zobj.net/source/apple/391/billed-cap_1f9e2.png" />
),
},
};

export const WithMuiIcon = {
export const FallbackLgSize: Story = {
args: {
background: true,
children: <PauseIcon />,
size: "lg",

children: <AvatarFallback>AR</AvatarFallback>,
},
};

export const WithMuiIconXL = {
export const FallbackDefaultSize: Story = {
args: {
background: true,
children: <PauseIcon />,
size: "xl",
children: <AvatarFallback>AR</AvatarFallback>,
},
};

export const WithAvatarIcon = {
export const FallbackSmSize: Story = {
args: {
background: true,
children: <AvatarIcon src="/icon/database.svg" alt="Database" />,
size: "sm",
children: <AvatarFallback>AR</AvatarFallback>,
},
};
Loading
Loading