Skip to content

Commit

Permalink
Avatar docs + preview
Browse files Browse the repository at this point in the history
  • Loading branch information
quietbits committed Sep 27, 2023
1 parent ee42785 commit 6767107
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"label": "Elements",
"link": {
"type": "generated-index"
}
}
19 changes: 19 additions & 0 deletions @stellar/design-system-website/docs/components/elements/avatar.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
slug: /avatar
---

# Avatar

<ComponentDescription componentName="Avatar" />

## Example

```tsx live
<PreviewBlock componentName="Avatar">
<Avatar publicAddress="GD4XW236EFCESNO4RKGG5PWML2WNQIJS335XECBW4GRARXKE64VIMOLZ" />
</PreviewBlock>
```

## Props

<ComponentProps componentName="Avatar" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ComponentPreview } from "@site/src/components/PreviewBlock";

export const avatarPreview: ComponentPreview = {
options: [],
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { captionPreview } from "@site/src/componentPreview/captionPreview";
import { paragraphPreview } from "@site/src/componentPreview/paragraphPreview";
import { titlePreview } from "@site/src/componentPreview/titlePreview";
import { notificationPreview } from "@site/src/componentPreview/notificationPreview ";
import { avatarPreview } from "@site/src/componentPreview/avatarPreview";

// =============================================================================
// Component previews
Expand All @@ -27,6 +28,7 @@ const previews: { [key: string]: ComponentPreview } = {
Paragraph: paragraphPreview,
Title: titlePreview,
Notification: notificationPreview,
Avatar: avatarPreview,
};

type Theme = "sds-theme-light" | "sds-theme-dark";
Expand Down
9 changes: 7 additions & 2 deletions @stellar/design-system/src/components/Avatar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { createStellarIdenticon } from "../../helpers/createStellarIdenticon";
import "./styles.scss";

type AvatarProps = {
/** */
export interface AvatarProps {
/** Public Stellar address */
publicAddress: string;
};
}

/**
* Unique identicon of public Stellar address. [We’re using stellar-identicon-js](https://github.com/Lobstrco/stellar-identicon-js).
*/
export const Avatar: React.FC<AvatarProps> = ({
publicAddress,
}: AvatarProps) => {
Expand Down

0 comments on commit 6767107

Please sign in to comment.