Skip to content
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

Feature/avatar component #129

Merged
merged 16 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: omit required prop id
  • Loading branch information
Twonarly1 committed Sep 28, 2023
commit 9faa4ec2377f4d12869c78ca29c0dd8be649533f
4 changes: 2 additions & 2 deletions examples/next/src/components/AvatarDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ const AvatarToggleDemo = () => {
<Wrapper title="Avatar">
<Flex direction="column" gap={2}>
{isLoaded ? (
<Avatar src="/img/logo.png" alt="avatar" id="" />
<Avatar src="/img/logo.png" alt="avatar" />
) : (
<Avatar src="" alt="" id="" />
<Avatar src="" alt="" />
)}
<Button
data-testid="toggle"
Expand Down
4 changes: 2 additions & 2 deletions examples/vite-react/src/components/AvatarDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const AvatarToggleDemo = () => {
<Wrapper title="Avatar">
<Flex direction="column" gap={2}>
{isLoaded ? (
<Avatar src="/img/logo.png" alt="avatar" id="" />
<Avatar src="/img/logo.png" alt="avatar" />
) : (
<Avatar src="" alt="" id="" />
<Avatar src="" alt="" />
)}
<Button
data-testid="toggle"
Expand Down
22 changes: 11 additions & 11 deletions src/components/core/Avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const AvatarToggle = () => {
return (
<Flex direction="column" gap={2}>
{isLoaded ? (
<Avatar src="/img/logo.png" alt="avatar" id="" />
<Avatar src="/img/logo.png" alt="avatar" />
) : (
<Avatar src="" alt="" id="" />
<Avatar src="" />
)}
<Button
data-testid="toggle"
Expand All @@ -37,22 +37,22 @@ export const Toggle: Story = {
export const Variants: Story = {
render: () => (
<HStack gap={2}>
<Avatar src="/img/logo.png" alt="avatar" id="" />
<Avatar variant="square" src="/img/logo.png" alt="avatar" id="" />
<Avatar src="/img/logo.png" alt="avatar" />
<Avatar variant="square" src="/img/logo.png" alt="avatar" />
</HStack>
),
};

export const Sizes: Story = {
render: () => (
<HStack gap={2}>
<Avatar size="xs" src="/img/logo.png" alt="avatar" id="" />
<Avatar size="sm" src="/img/logo.png" alt="avatar" id="" />
<Avatar src="/img/logo.png" alt="avatar" id="" />
<Avatar size="lg" src="/img/logo.png" alt="avatar" id="" />
<Avatar size="xl" src="/img/logo.png" alt="avatar" id="" />
<Avatar size="2xl" src="/img/logo.png" alt="avatar" id="" />
<Avatar size="3xl" src="/img/logo.png" alt="avatar" id="" />
<Avatar size="xs" src="/img/logo.png" alt="avatar" />
<Avatar size="sm" src="/img/logo.png" alt="avatar" />
<Avatar src="/img/logo.png" alt="avatar" />
<Avatar size="lg" src="/img/logo.png" alt="avatar" />
<Avatar size="xl" src="/img/logo.png" alt="avatar" />
<Avatar size="2xl" src="/img/logo.png" alt="avatar" />
<Avatar size="3xl" src="/img/logo.png" alt="avatar" />
</HStack>
),
};
Expand Down
5 changes: 4 additions & 1 deletion src/components/core/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { useIsMounted } from "lib/hooks";
import type { PrimitiveAvatarProps } from "components/primitives";
import type { AvatarVariantProps } from "generated/panda/recipes";

export interface Props extends PrimitiveAvatarProps, AvatarVariantProps {
export interface Props
// TODO: remove children omit once `@ark-ui/react` fixes required children type
extends Omit<PrimitiveAvatarProps, "id">,
AvatarVariantProps {
src?: string;
alt?: string;
fallback?: string;
Expand Down