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(Card): adding support for darker mode and noBorder options #576

Conversation

aversini
Copy link
Collaborator

@aversini aversini commented Jul 6, 2024

Summary by CodeRabbit

  • New Features

    • Added noBorder prop to the Card component, allowing cards to be rendered without borders.
    • Introduced a new "darker" mode option for the Card component, providing an additional visual style.
  • Tests

    • Implemented new test cases to verify the rendering of cards with the noBorder prop and the "darker" mode.
  • Documentation

    • Updated component stories to reflect the new noBorder prop and "darker" mode option.

Copy link

coderabbitai bot commented Jul 6, 2024

Walkthrough

This update introduces a new noBorder prop to the Card component, along with an additional "darker" mode. These changes extend to the story, type definitions, utility functions, and tests, allowing for more customizable card styles and better storybook representation.

Changes

File(s) Change Summary
.../Card.stories.tsx Added noBorder prop with default false, updated mode options to include "darker" in args and argTypes.
.../Card.tsx Added noBorder prop with default false to Card component.
.../CardTypes.d.ts Included noBorder prop with default false in CardProps; added "darker" to mode options.
.../__tests__/Card.test.tsx Added test cases for rendering cards with noBorder and "darker" mode.
.../Card/utilities.ts Updated getCardClasses function—added noBorder boolean property and "darker" mode, affecting border and background styles.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Card
    participant Storybook
    participant UI

    User->>Storybook: Requests Card component with `noBorder`
    Storybook->>UI: Instantiates Card with `noBorder` prop
    UI->>Card: Render with `noBorder=false` (default)
    User->>Storybook: Requests Card component with "darker" mode
    Storybook->>UI: Instantiates Card with `mode="darker"`
    UI->>Card: Render with darker style applied
Loading

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

github-actions bot commented Jul 6, 2024

Bundle Size (components)

Status File Size (Gzip) Limits
style.css 7.36 KB (+7 B +0.09%) 8 KB
index.js 9.8 KB (+23 B +0.23%) 10 KB
vendor.js 65.49 KB 67 KB

Overall bundle size: 82.65 KB (+30 B +0.04%)
Overall status: ✅

Bundle Size (form components)

Status File Size (Gzip) Limits
index.js 4.84 KB (-1 B -0.02%) 20 KB
vendor.js 44.46 KB 67 KB

Overall bundle size: 49.3 KB (-1 B 0.00%)
Overall status: ✅

Bundle Size (system)

Status File Size (Gzip) Limits
style.css 7.67 KB (+7 B +0.09%) 8 KB
index.js 1.93 KB (+1 B +0.05%) 3 KB
vendor.js 44.46 KB 46 KB

Overall bundle size: 54.06 KB (+8 B +0.01%)
Overall status: ✅

Copy link

@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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f204c67 and 93642f9.

Files selected for processing (5)
  • packages/documentation/src/Components/Card.stories.tsx (1 hunks)
  • packages/ui-components/src/components/Card/Card.tsx (2 hunks)
  • packages/ui-components/src/components/Card/CardTypes.d.ts (1 hunks)
  • packages/ui-components/src/components/Card/tests/Card.test.tsx (1 hunks)
  • packages/ui-components/src/components/Card/utilities.ts (3 hunks)
Additional comments not posted (9)
packages/ui-components/src/components/Card/CardTypes.d.ts (1)

44-49: LGTM! The new properties are well-defined.

The noBorder property and the "darker" mode option are correctly added with appropriate documentation and default values.

packages/documentation/src/Components/Card.stories.tsx (2)

12-12: LGTM! The new noBorder property is correctly added to the args.

The noBorder property is added with a default value of false, which aligns with the PR objectives.


16-16: LGTM! The new "darker" mode option is correctly added to the argTypes.

The mode prop now includes the "darker" option, which aligns with the PR objectives.

packages/ui-components/src/components/Card/utilities.ts (2)

13-14: LGTM! The new properties are well-defined.

The noBorder property and the "darker" mode option are correctly added with appropriate documentation.


25-38: LGTM! The new properties are correctly handled.

The noBorder property and the "darker" mode option are correctly handled in the getCardClasses function logic.

packages/ui-components/src/components/Card/Card.tsx (2)

43-43: LGTM! The new noBorder property is correctly added to the Card component props.

The noBorder property is added with a default value of false, which aligns with the PR objectives.


61-61: LGTM! The new noBorder property is correctly passed to the getCardClasses function.

The noBorder property is correctly passed to the getCardClasses function, which aligns with the PR objectives.

packages/ui-components/src/components/Card/__tests__/Card.test.tsx (2)

78-90: Test case for "darker" mode looks good.

The test case correctly verifies the rendering of the card with appropriate classes for the "darker" mode.


92-107: Test case for noBorder property looks good.

The test case correctly verifies the rendering of the card with appropriate classes for the noBorder property.

@aversini aversini merged commit 40c03e9 into main Jul 6, 2024
6 checks passed
@aversini aversini deleted the feat(Card)-adding-support-for-darker-mode-and-noBorder-options branch July 6, 2024 14:17
@aversini aversini mentioned this pull request Jul 6, 2024
aversini added a commit that referenced this pull request Jul 6, 2024
🤖 I have created a release *beep* *boop*
---


<details><summary>ui-components: 5.20.0</summary>

##
[5.20.0](ui-components-v5.19.6...ui-components-v5.20.0)
(2024-07-06)


### Features

* **Card:** adding support for darker mode and noBorder options
([#576](#576))
([40c03e9](40c03e9))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: aversini <[email protected]>
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.

1 participant