Skip to content
This repository has been archived by the owner on Oct 3, 2023. It is now read-only.

Added Avatar component to component library docs #22

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 11 additions & 0 deletions docs/contributing-guide/components/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"label": "Component Library",
"position": 3,
"collapsed": true,
"link": {
"type": "generated-index",
"description": "Guides for component library"
}
}


66 changes: 66 additions & 0 deletions docs/contributing-guide/components/avatar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
id: avatar
title: Avatar
---

The Avatar component is a versatile and reusable component that allows you to display user avatars or profile pictures in our app. We can customize it by passing various props to suit our component needs. In this guide, we'll walk through how to use the Avatar component in codebase.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make it 'allows us' instead of 'allows you'


#### Importing the Avatar Component
To use the Avatar component in our app, we need to import it from our styled components. Here's how we can import it:

```
import { Avatar } from "StyledComponents";
```
![default avatar](/img/avatar/default.png)

#### Using the Avatar Component
The Avatar component can be used with various props to control its appearance. Here are some examples of how we can use it:

```
<Avatar
url={company.logo || logo}
/>
```
![avatar with url](/img/avatar/with-url.png)


```
<Avatar
name="Hello Moto"
/>
```

![avatar with name](/img/avatar/with-name.png)

```
<Avatar
name="Hello Moto"
initialsLetterCount={1}
/>
```
![avatar with name](/img/avatar/with-initials-count.png)

```
<Avatar
classNameImg="mr-5"
classNameInitials="lg:text-5xl text-lg font-bold capitalize text-white"
classNameInitialsWrapper="mr-5 bg-miru-gray-1000"
initialsLetterCount={1}
name={company.name}
size="h-10 w-10 lg:h-20 lg:w-20"
url={company.logo || logo}
/>
```

#### Avatar Component Props

| Name | Description | Default Value |
|---------------|-----------------------------------------------------------|---------------|
| `url` | Provide the url of the logo | `""` |
| `name` | Pass any name or string value, so that it will display the avatar with initials. | `""` |
| `initialsLetterCount` | Number of initials to appear in the avatar if the name is provided instead of url | 2 |
| `size` | Specify the size of the avatar. | `"md:h-10 md:w-10 h-6 w-6"` |
| `classNameImg` | Specify the style classes needed avatar image | `"inline-block rounded-full"` |
| `classNameInitials` | To provide external classnames for the initials styling. Should be a string. | `"md:text-xl text-xs md:font-medium font-light leading-none text-white"` |
| `classNameInitialsWrapper` | To provide external classnames for the initials wrapper styling. Should be a string. | `"inline-flex rounded-full items-center justify-center bg-gray-500"` |
| `style`| Custom css styles which are not the part of tailwind. | `""` |
Binary file added static/img/avatar/default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/avatar/with-initials-count.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/avatar/with-name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/avatar/with-url.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.