Skip to content

Conversation

@andreyjamer
Copy link
Contributor

@andreyjamer andreyjamer commented Feb 14, 2025

There is a problem with placeholder position in avatar component. There is an optical compensation for default placeholder, that moves the icon with absolute position and bottom property. But if there is a placeholder provided by user then this compensation causes strange display of the icon.

For example, this is how the custom placeholder looks in current implementation in different sizes:
image
I added the blue border for the placeholder to show how it is positioned in the block.

I would expect that placeholder should be placed in the center of the avatar.

And this is how it is placed with my changes:
image

Summary by CodeRabbit

  • Style

    • Updated the appearance of avatar placeholders to ensure a more distinct and consistent icon display when no image or initials are provided.
  • Refactor

    • Streamlined the styling logic for avatars by separating icon-specific styles from the default placeholder, enhancing visual consistency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 14, 2025

Walkthrough

This pull request updates the FwbAvatar component by changing the SVG element’s class binding from avatarPlaceholderClasses to avatarPlaceholderIconClasses. In addition, the composable in useAvatarClasses has been enhanced: the default placeholder classes now exclude the absolute positioning, a new constant (avatarPlaceholderDefaultIconClasses) is introduced, and a new computed property (avatarPlaceholderIconClasses) is added to the return object. These changes collectively adjust the styling logic for avatar placeholders to allow distinct class management for icons.

Changes

File(s) Change Summary
src/components/FwbAvatar/FwbAvatar.vue, src/.../useAvatarClasses.ts Updated the SVG placeholder binding in the Vue component from avatarPlaceholderClasses to avatarPlaceholderIconClasses. In the composable, removed absolute from avatarPlaceholderDefaultClasses, added avatarPlaceholderDefaultIconClasses, and introduced a new computed property avatarPlaceholderIconClasses in the returned interface.

Suggested labels

🔧 enhancement

Suggested reviewers

  • Sqrcz

Poem

I'm a bunny with a coding flair,
Hopping through components without a care.
New icon classes make the view so bright,
Tail-wagging changes in the code tonight.
With every hop, my joy's set free—
Celebrating improvements with a bunny decree! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 476919b and adb70ce.

📒 Files selected for processing (2)
  • src/components/FwbAvatar/FwbAvatar.vue (2 hunks)
  • src/components/FwbAvatar/composables/useAvatarClasses.ts (4 hunks)
🔇 Additional comments (3)
src/components/FwbAvatar/FwbAvatar.vue (1)

21-21: LGTM! Changes improve placeholder icon positioning.

The switch to avatarPlaceholderIconClasses for the SVG element and its addition to the destructured return values provides better control over icon positioning, addressing the optical compensation issue mentioned in the PR description.

Also applies to: 106-106

src/components/FwbAvatar/composables/useAvatarClasses.ts (2)

43-44: LGTM! Better separation of positioning styles.

The separation of absolute positioning into a dedicated icon class constant improves flexibility for custom placeholders while maintaining the desired positioning for the default icon.


97-103: LGTM! Well-structured computed property for icon classes.

The new avatarPlaceholderIconClasses computed property correctly combines:

  • Base placeholder styles
  • Icon-specific positioning
  • Size-specific adjustments
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit adb70ce
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/67af3fdb4ce88b000859193a
😎 Deploy Preview https://deploy-preview-350--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@andreyjamer andreyjamer changed the title Fixed the icon placeholder position Fixed the icon placeholder position in FwbAvatar Feb 14, 2025
@Sqrcz Sqrcz self-assigned this Feb 14, 2025
@Sqrcz Sqrcz added the 🪲 bug Something isn't working label Feb 14, 2025
Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

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

nice catch!

Thank you 🙌

@Sqrcz Sqrcz merged commit 9b67c06 into themesberg:main Feb 19, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🪲 bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants