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

feat: allow using initials as Avatar placeholder #375

Merged
merged 4 commits into from
Oct 11, 2022

Conversation

iamargentum
Copy link
Contributor

@iamargentum iamargentum commented Oct 9, 2022

Refs: #357

Description

This PR adds a new prop, placeholderInitials, to the Avatar component. String passed in this prop will be displayed as Avatar's placeholder, if image is not provided.

Fixes #357

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change contains documentation update

Breaking changes

No breaking changes

How Has This Been Tested?

Just checked visually

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
Screencast.from.10-10-22.01.57.39.AM.IST.webm

Add new prop, `placeholderInitials`, to the `Avatar` component.
String passed in this prop will be displayed as `Avatar`'s placeholder, if image is not provided.

Refs: themesberg#357
Update the docs with newly added feature, that allows usage of initials as a placeholder for
`Avatar` component

themesberg#357
src/lib/components/Avatar/index.tsx Outdated Show resolved Hide resolved
src/lib/components/Avatar/index.tsx Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Base: 98.61% // Head: 98.59% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (744042e) compared to base (6f6a63a).
Patch coverage: 94.44% of modified lines in pull request are covered.

❗ Current head 744042e differs from pull request most recent head 922eb83. Consider uploading reports for the commit 922eb83 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #375      +/-   ##
==========================================
- Coverage   98.61%   98.59%   -0.02%     
==========================================
  Files          89       89              
  Lines        4116     4138      +22     
  Branches      375      377       +2     
==========================================
+ Hits         4059     4080      +21     
- Misses         57       58       +1     
Impacted Files Coverage Δ
src/lib/components/Avatar/index.tsx 98.05% <92.85%> (-0.82%) ⬇️
src/lib/theme/default.ts 100.00% <100.00%> (ø)
src/lib/components/Button/index.tsx 100.00% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@iamargentum iamargentum requested a review from rluders October 11, 2022 04:43
Copy link
Collaborator

@rluders rluders left a comment

Choose a reason for hiding this comment

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

Thanks.

@rluders
Copy link
Collaborator

rluders commented Oct 11, 2022

@iamargentum I guess that now the CI is just saying that we need to put some unit test to cover the new logic. :)

@iamargentum
Copy link
Contributor Author

iamargentum commented Oct 11, 2022

okay!
I've never really written a test though
i'll try to replicate what existing tests do, for the new logic

@iamargentum iamargentum requested a review from rluders October 11, 2022 13:19
@rluders rluders merged commit e349d82 into themesberg:main Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing avatar with placeholder initials
2 participants