This repository has been archived by the owner on Oct 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Added Avatar component to component library docs #22
Open
prasanthchaduvula
wants to merge
2
commits into
main
Choose a base branch
from
add-miru-styled-components-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
#### 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. | `""` | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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'