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

chore: updating list item and list components in ADS #38344

Open
wants to merge 4 commits into
base: release
Choose a base branch
from

Conversation

ankitakinger
Copy link
Contributor

@ankitakinger ankitakinger commented Dec 24, 2024

Description

Tip

Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team).

Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR.

Fixes #Issue Number
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags=""

🔍 Cypress test results

Warning

Tests have not run on the HEAD 924ae26 yet


Wed, 25 Dec 2024 09:42:25 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a more flexible rightControl property for list items, enhancing interactivity.
    • Added rightControlVisibility property to control the display of right controls.
  • Bug Fixes

    • Improved rendering logic for descriptions in list items.
  • Style

    • Enhanced styling for Wrapper and StyledListItem components, improving visual feedback and layout.
  • Refactor

    • Replaced the Entity component with the new ListItem component in the action entity rendering.
    • Updated API method icon dimensions for better visual representation.

Copy link
Contributor

coderabbitai bot commented Dec 24, 2024

Walkthrough

This pull request introduces significant modifications to the List component across multiple files in the design system. The changes primarily focus on replacing the endIcon property with a more flexible rightControl prop, allowing for dynamic control elements in list items. The updates enhance the component's API by introducing rightControlVisibility and making certain properties optional, thereby improving the overall flexibility and usability of the List component.

Changes

File Change Summary
.../List/List.stories.tsx Updated story imports, replaced endIcon with rightControl, added rightControlVisibility
.../List/List.styles.tsx Added RightControlWrapper, modified Wrapper with new visibility prop, removed ContentTextWrapper
.../List/List.tsx Replaced endIcon with rightControl, updated rendering logic
.../List/List.types.tsx Modified ListItemProps interface, made description and descriptionType optional
.../Explorer/Actions/ActionEntity.tsx Replaced Entity component with ListItem, updated rendering approach
.../Explorer/ExplorerIcons.tsx Minor adjustments to ApiMethodIcon default dimensions

Possibly related PRs

Suggested Labels

IDE Product, Task, IDE Pod, ok-to-test, Design System Product

Suggested Reviewers

  • albinAppsmith
  • sagar-qa007

Poem

🎨 Behold the List, now more refined,
With controls that dance and intertwined,
Right-side magic, hover or stay,
Flexibility finds its playful way!
Code evolves, beauty redesigned 🚀


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.

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.

@ankitakinger
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 24, 2024
Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/12479029057.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 38344.
recreate: .

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

🧹 Nitpick comments (10)
app/client/packages/design-system/ads/src/List/List.types.tsx (2)

9-10: Consider renaming for clarity.

“rightControl” is concise, but “endControl” or “actions” might better convey its purpose if it typically contains actions like icons or buttons.


11-12: Add JSDoc description.

The rightControlVisibility property should include a more descriptive JSDoc comment that clarifies its role in controlling visibility.

app/client/packages/design-system/ads/src/List/List.styles.tsx (4)

51-56: Use consistent control toggle.

Hiding the RightControlWrapper on hover is elegant, but confirm all pointer events still work seamlessly, especially for screen readers.


61-63: Active state styling.

Check if the active state complements the final design. Sometimes an even darker shade clarifies active feedback.


65-67: Selected state.

Reusing active-bg for selected state can be confusing. Consider a distinct color or style for persistent selection.


110-116: RightControlWrapper usage.

This container is a valid approach for grouping interactive elements on the right side. Ensure clickable regions have adequate a11y attributes if needed.

app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (2)

24-24: Clean code preference.

Commented-out import suggests the code was deprecated. Remove these lines if they're fully obsolete.


29-35: Remove stale code.

These commented-out functions indicate a change in approach for updating action names. Delete them if they're not needed.

app/client/packages/design-system/ads/src/List/List.tsx (1)

129-136: Descriptive text usage.

Displaying title via TextWithTooltip is great. Confirm large titles are truncated gracefully.

app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

164-165: Good use of the new hover-based visibility.
Ensure that the hover interaction is clearly documented so users understand how the control rendering toggles.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 16953b8 and 3ccf437.

📒 Files selected for processing (6)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.styles.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (3 hunks)
  • app/client/packages/design-system/ads/src/List/List.types.tsx (2 hunks)
  • app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (3 hunks)
  • app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx (1 hunks)
🔇 Additional comments (25)
app/client/src/pages/Editor/Explorer/ExplorerIcons.tsx (1)

269-270: Confirm that the new icon dimensions uphold the intended design.

The default height and width have been slightly reduced from 18px→16px and 36px→34px, respectively. Please ensure this aligns with design and layout requirements across the application.

app/client/packages/design-system/ads/src/List/List.types.tsx (2)

26-26: Good choice making description optional.

This makes the component more flexible for items without a description.


30-30: Consistent naming recommendation.

With descriptionType now optional, ensure conditioning logic consistently checks for undefined before usage.

app/client/packages/design-system/ads/src/List/List.styles.tsx (7)

39-41: Enhanced flexibility with typed prop.

Extending Wrapper to accept rightControlVisibility is a neat way to handle hover-based displays.


48-50: Ensure consistent sizing.

Adjusting the border-radius and min-height is fine, but confirm these changes match the rest of the design system’s guidelines for list items.


57-59: Hover color alignment.

This hover color is consistent with the design system’s hover states. Nice job!


69-74: Disabled overrides.

The reduced opacity and not-allowed cursor are standard patterns, which is good. Verify that hover or focus states don’t override them.


76-81: Focus outline clarity.

Ensuring a clear, accessible focus outline is essential. Great to see these focus-visible rules.


129-132: Spacing changes.

Adjusting padding and gap looks fine, but double-check it aligns with other design system components for seamless consistency.


159-159: Line-height update.

Increasing line-height improves readability; ensure it doesn’t break layout for multiline descriptions.

app/client/src/pages/Editor/Explorer/Actions/ActionEntity.tsx (3)

3-3: Import retention confirmation.

Confirm you still need EntityClassNames. If not, removing it will keep code tidy.


27-27: Align import sources.

Importing ListItem from "@appsmith/ads" is consistent with the new approach. Good job.


113-120: Variadic props usage.

Using the ListItem with rightControl and rightControlVisibility is consistent with the new design. Confirm the class name “action t--action-entity” remains relevant under new styling.

app/client/packages/design-system/ads/src/List/List.tsx (9)

8-8: Check import usage.

The newly added import for RightControlWrapper must match references in the file to avoid potential bundling issues.


87-88: Increased customizability.

Introducing rightControl and rightControlVisibility is a flexible alternative to a single endIcon. Good approach!


113-119: Proper data attributes.

Using data-disabled and data-selected is a clean way to handle styling states. Confirm that UI test frameworks reference these accurately.


127-128: Named handler.

Separating the click and keydown handlers fosters clarity. The inline arrow function is short and fine here.


138-140: Color usage for errors.

Using a direct CSS variable for error color is straightforward and consistent with the system.


146-147: Block vs inline logic.

Ensuring the block description is only rendered if it exists is correct. Great clarity in condition usage.


148-155: Inline description usage.

Similarly, this condition ensures inline descriptions are only displayed if present, which is clean and robust.


156-156: Fallback check.

rightControl presence is neatly handled with a short conditional. No complaints here.


158-159: Right control wrapper.

Logic is straightforward: if rightControl is defined, wrap it. This approach fosters modularity.

app/client/packages/design-system/ads/src/List/List.stories.tsx (3)

2-2: Great addition of the Button import.
It appears you’re utilizing the Button component for the right control. No concerns here.


82-86: Good introduction of the rightControl property.
The ReactNode type choice makes it suitably flexible for various controls.


217-224: Nice addition of the ListItemRightControlStory.
Your new story is consistent with the updated API, providing a clear example of using Button as the right control element.

Copy link

Deploy-Preview-URL: https://ce-38344.dp.appsmith.com

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: 0

🧹 Nitpick comments (1)
app/client/packages/design-system/ads/src/List/List.stories.tsx (1)

82-96: Consider grouping related props together

The customTitleComponent prop should be grouped with other visual/layout props like title and startIcon for better organization of the API documentation.

Also applies to: 149-156

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3ccf437 and 924ae26.

📒 Files selected for processing (3)
  • app/client/packages/design-system/ads/src/List/List.stories.tsx (5 hunks)
  • app/client/packages/design-system/ads/src/List/List.tsx (4 hunks)
  • app/client/packages/design-system/ads/src/List/List.types.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/packages/design-system/ads/src/List/List.types.tsx
🔇 Additional comments (6)
app/client/packages/design-system/ads/src/List/List.tsx (4)

8-8: LGTM: Import addition for RightControlWrapper


87-88: LGTM: Props update for enhanced control flexibility

The replacement of endIcon with rightControl and rightControlVisibility provides better flexibility for list item controls.


113-119: LGTM: Enhanced wrapper attributes for better state management

Good addition of data attributes for disabled and selected states, along with rightControlVisibility prop.


162-164: LGTM: Clean implementation of rightControl rendering

app/client/packages/design-system/ads/src/List/List.stories.tsx (2)

2-2: LGTM: Import addition for Button component


173-173: LGTM: Comprehensive story examples for rightControl usage

Good examples showing both simple icon and button usage in rightControl.

Also applies to: 225-232

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant