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

fix(docs): removed external links for images and used static #1451

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

marcinsawicki
Copy link
Contributor

@marcinsawicki marcinsawicki commented Dec 10, 2024

Resolves: #{issue-number}

Description

removed external links for images and used static

Storybook

https://feature-external-images-remove--613a8e945a5665003a05113b.chromatic.com

Checklist

Obligatory:

  • Self review (use this as your final check for proposed changes before requesting the review)
  • Add correct label
  • Assign pull request with the correct issue

Summary by CodeRabbit

  • New Features

    • Updated avatar images in various components to use local assets instead of hardcoded URLs.
    • Enhanced visual representation of the Card, Avatar, Picker, and Tag components in Storybook.
  • Bug Fixes

    • Removed the hardcoded default image URL in the Avatar component stories for a more consistent experience.
  • Style

    • Adjusted SCSS styles for the Card component by removing the background color property from the header image.

@marcinsawicki marcinsawicki added the documentation Documentation of any kind label Dec 10, 2024
@marcinsawicki marcinsawicki added this to the Cycle #10 milestone Dec 10, 2024
@marcinsawicki marcinsawicki self-assigned this Dec 10, 2024
Copy link
Contributor

coderabbitai bot commented Dec 10, 2024

Walkthrough

This pull request implements changes across multiple components in the React project, focusing on updating image sources. It replaces hardcoded URLs with local asset imports for the Avatar, Card, InviteAgents, Picker, and Tag components. The modifications enhance the visual representation of these components in Storybook without altering their overall structure or functionality.

Changes

File Path Change Summary
packages/react-components/src/components/Avatar/Avatar.stories.tsx Removed defaultImage variable; replaced hardcoded URLs with an imported image asset.
packages/react-components/src/components/Card/Card.module.scss Removed background-color property from &__image class.
packages/react-components/src/components/Card/Card.stories.tsx Added image import; updated src properties for multiple story exports to use the imported image.
packages/react-components/src/components/InviteAgents/InviteAgents.stories.tsx Updated avatar property for agents in mockAgents to use an imported image instead of a placeholder URL.
packages/react-components/src/components/Picker/Picker.stories.tsx Added image import; replaced hardcoded image URLs in PickerWithOptionsAsCustomElements story.
packages/react-components/src/components/Picker/constants.tsx Updated avatarSrc in DEFAULT_MORE_PICKER_OPTIONS to use an imported image instead of a static URL.
packages/react-components/src/components/Tag/Tag.stories.tsx Updated exampleAvatar variable to use an imported image instead of a hardcoded URL.

Possibly related PRs

Suggested reviewers

  • vladko-uxds: Suggested for review based on expertise in component design and implementation.

🪧 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. (Experiment)
  • @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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
packages/react-components/src/components/Picker/Picker.stories.tsx (1)

5-5: Consider extracting repeated image element into a shared component

The same image markup is duplicated across multiple custom elements. Consider creating a reusable component:

+const CustomPickerImage = ({ isSelected }) => (
+  <img 
+    className={`image${isSelected ? ' selected' : ''}`} 
+    src={image} 
+    alt="Custom picker item"
+  />
+);

 // Usage:
-<img className="image" src={image} />
+<CustomPickerImage />

-<img className="image selected" src={image} />
+<CustomPickerImage isSelected />

Also applies to: 175-175, 184-184, 198-198, 207-207, 228-228, 237-237, 249-249, 258-258

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 56b00a7 and f6a21b9.

⛔ Files ignored due to path filters (2)
  • packages/react-components/src/stories/assets/avatar.jpg is excluded by !**/*.jpg
  • packages/react-components/src/stories/assets/folder.svg is excluded by !**/*.svg
📒 Files selected for processing (7)
  • packages/react-components/src/components/Avatar/Avatar.stories.tsx (5 hunks)
  • packages/react-components/src/components/Card/Card.module.scss (0 hunks)
  • packages/react-components/src/components/Card/Card.stories.tsx (5 hunks)
  • packages/react-components/src/components/InviteAgents/InviteAgents.stories.tsx (2 hunks)
  • packages/react-components/src/components/Picker/Picker.stories.tsx (9 hunks)
  • packages/react-components/src/components/Picker/constants.tsx (2 hunks)
  • packages/react-components/src/components/Tag/Tag.stories.tsx (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/react-components/src/components/Card/Card.module.scss
🔇 Additional comments (4)
packages/react-components/src/components/Card/Card.stories.tsx (1)

6-6: LGTM! Verify image asset existence

The placeholder URLs have been consistently replaced with the static image.

Also applies to: 28-28, 39-39, 51-51, 74-74

✅ Verification successful

Image asset verified successfully

The folder.svg image exists at the expected location: packages/react-components/src/stories/assets/folder.svg

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the image asset exists
fd -t f "folder.svg" packages/react-components/src/stories/assets/

Length of output: 122

packages/react-components/src/components/InviteAgents/InviteAgents.stories.tsx (1)

4-5: Verify the mixed avatar states

The changes maintain a mix of avatar states (empty, undefined, and image) which appears intentional for testing different scenarios.

Also applies to: 42-42, 49-49, 56-56

✅ Verification successful

Let me verify the usage of mixed avatar states in the code.


Mixed avatar states are correctly implemented for testing

The mockAgents array intentionally includes all avatar scenarios:

  • Empty string avatar (Bob Smith)
  • Undefined avatar (Alice Johnson)
  • Image avatar (Alice Johnson 2, Bob Smith, Unknown Agents)

This variety ensures proper testing of avatar rendering in different states.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the avatar image exists
fd -t f "avatar.jpg" packages/react-components/src/stories/assets/

Length of output: 122


Script:

#!/bin/bash
# Check the content of InviteAgents.stories.tsx to verify mixed avatar states
rg -U "mockAgents.*?\]" packages/react-components/src/components/InviteAgents/InviteAgents.stories.tsx

Length of output: 104


Script:

#!/bin/bash
# Let's try a different approach to get the content
cat packages/react-components/src/components/InviteAgents/InviteAgents.stories.tsx

Length of output: 2564

packages/react-components/src/components/Picker/constants.tsx (1)

3-3: Consider dedicated picker assets

While reusing avatar.jpg works, consider using a more contextually appropriate image for picker examples.

Also applies to: 87-87

packages/react-components/src/components/Tag/Tag.stories.tsx (1)

6-6: LGTM: Image source updated correctly

The hardcoded URL has been properly replaced with a local image import.

Also applies to: 19-19

@@ -2,6 +2,7 @@ import * as React from 'react';

import { Meta } from '@storybook/react';

import image from '../../stories/assets/avatar.jpg';
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Missing alt text in multiple Avatar components

Several Avatar components with type="image" are missing the alt attribute:

  • Line with withRim type="image" src={image}
  • Line with withRim status="available" type="image" src={image}
  • Line with type="image" src={image} size={size} status="available"
  • Line with type="image" src={image} size={size} withRim
  • Line with type="image" src="https://example.com/not-a-proper-image.png"
🔗 Analysis chain

Ensure image accessibility attributes are consistent

While the image source updates are correct, verify that all instances have proper alt text for accessibility.

Also applies to: 30-30, 102-102, 105-105, 115-115, 134-134

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for missing alt attributes in Avatar components
rg -l "Avatar.*type=\"image\"" | xargs rg "type=\"image\"" -A 2 -B 2

Length of output: 1044

Copy link

@vladko-uxds vladko-uxds left a comment

Choose a reason for hiding this comment

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

@marcinsawicki marcinsawicki merged commit 7ed07d2 into main Dec 10, 2024
6 checks passed
@marcinsawicki marcinsawicki deleted the feature/external-images-remove branch December 10, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Documentation of any kind
Projects
Development

Successfully merging this pull request may close these issues.

3 participants