Skip to content

Commit

Permalink
fix: docs - avatar - render properly code example (#1006)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Sutu <[email protected]>
  • Loading branch information
SutuSebastian and Sebastian Sutu authored Sep 27, 2023
1 parent 409c01c commit 48ce786
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion app/docs/components/avatar/avatar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,33 @@ Change the default size of the avatar component by passing the `size` prop. Size

You can override the default image element by passing the `img` prop to the `<Avatar>` component. This is useful if you want to use a different image element like `<Image>` from Next.js.

<CodePreview importFlowbiteReact="Avatar" title="Override image element">
<CodePreview
importFlowbiteReact="Avatar"
title="Override image element"
code={`<div className="flex flex-wrap gap-2">
<Avatar
img={(props) => (
<Image
alt=""
height="48"
referrerPolicy="no-referrer"
src="/images/people/profile-picture-5.jpg"
width="48"
{...props}
/>
)}
/>
<Avatar
img={(props) => (
<picture>
<source media="(min-width: 900px)" srcSet="/images/people/profile-picture-3.jpg" />
<source media="(min-width: 480px)" srcSet="/images/people/profile-picture-4.jpg" />
<Image alt="" height="48" src="/images/people/profile-picture-5.jpg" width="48" {...props} />
</picture>
)}
/>
</div>`}
>
<div className="flex flex-wrap gap-2">
<Avatar
img={(props) => (
Expand Down

1 comment on commit 48ce786

@vercel
Copy link

@vercel vercel bot commented on 48ce786 Sep 27, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.