Skip to content

chore: Checkbox widget does not show an asterisk to indicate it's a required#33814

Merged
KelvinOm merged 3 commits intoreleasefrom
fix/checkbox-asterik
May 30, 2024
Merged

chore: Checkbox widget does not show an asterisk to indicate it's a required#33814
KelvinOm merged 3 commits intoreleasefrom
fix/checkbox-asterik

Conversation

@jsartisan
Copy link
Contributor

@jsartisan jsartisan commented May 29, 2024

Fixes #33444

/ok-to-test tags="@tag.Anvil"

Warning

Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9297202278
Commit: 895c87c
Cypress dashboard url: Click here!
It seems like no tests ran 😔. We are not able to recognize it, please check workflow here.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Bug Something isn't working High This issue blocks a user from building or impacts a lot of users WDS team labels May 29, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 29, 2024

Walkthrough

Walkthrough

The Checkbox component has been updated to display an asterisk (*) next to the label when it is marked as required (isRequired prop is true). This change ensures that the necessity of the checkbox is visually indicated to users. Additionally, associated styles have been adjusted to support this new feature, and stories have been updated to demonstrate the required state.

Changes

File Path Change Summary
app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx Conditionally renders an asterisk (*) with a negative color as a necessity indicator if props.isRequired is true.
app/client/packages/design-system/widgets/src/components/Checkbox/src/styles.module.css Adds styling for an inline label necessity indicator icon and adjusts border color for invalid states.
app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.tsx Adds a new story named IsRequired to demonstrate the Checkbox component with the isRequired prop set to true.
app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx Modifies Checkbox component usage by adjusting the isRequired prop in the LightMode story.
app/client/packages/design-system/widgets/src/styles/src/field.module.css Changes the CSS property margin-left to margin-inline-start for the necessity indicator icon.

Sequence Diagram(s) (Beta)

N/A

Assessment against linked issues

Objective Addressed Explanation
Checkbox widget should display an asterisk to indicate it's required (#33444).

Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0e47b95 and 895c87c.
Files selected for processing (5)
  • app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx (1 hunks)
  • app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx (1 hunks)
  • app/client/packages/design-system/widgets/src/components/Checkbox/src/styles.module.css (2 hunks)
  • app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.tsx (1 hunks)
  • app/client/packages/design-system/widgets/src/styles/src/field.module.css (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • app/client/packages/design-system/widgets/src/components/Checkbox/src/Checkbox.tsx
  • app/client/packages/design-system/widgets/src/components/Checkbox/src/styles.module.css
  • app/client/packages/design-system/widgets/src/styles/src/field.module.css
Additional Context Used
Biome (2)
app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx (1)

22-29: Missing key property for this element in iterable.

app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.tsx (1)

56-57: Alternative text title element cannot be empty

Additional comments not posted (2)
app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx (1)

31-36: The addition of the isRequired prop to the Checkbox component aligns with the PR objectives to indicate required fields. Good implementation!

app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.tsx (1)

68-74: The new IsRequired story effectively demonstrates the required state of the Checkbox component. This is a valuable addition for visual testing.


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>.
    • 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.

@github-actions github-actions bot added skip-changelog Adding this label to a PR prevents it from being listed in the changelog Bug Something isn't working and removed Bug Something isn't working labels May 29, 2024
@jsartisan jsartisan added the ok-to-test Required label for CI label May 29, 2024
@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels May 29, 2024
& [data-field-necessity-indicator-icon] {
color: var(--color-fg-negative);
margin-left: var(--inner-spacing-1);
margin-inline-start: var(--inner-spacing-1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

tiny refactor.

@jsartisan
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

Deploy-Preview-URL: https://ce-33814.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

Outside diff range and nitpick comments (1)
app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx (1)

Line range hint 22-29: Add a unique key prop to each element in the iterable to ensure efficient updates and re-renders.

-        <>
+        <React.Fragment key={state}>
           <DataAttrWrapper attr={state} key={state}>
             <Checkbox>unchecked {state}</Checkbox>
           </DataAttrWrapper>
           <DataAttrWrapper attr={state} key={state}>
             <Checkbox defaultSelected>checked {state}</Checkbox>
           </DataAttrWrapper>
-        </>
+        </React.Fragment>

@jsartisan jsartisan force-pushed the fix/checkbox-asterik branch from 0e47b95 to 6096b0c Compare May 29, 2024 09:55
@jsartisan jsartisan added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 29, 2024
@jsartisan jsartisan requested a review from KelvinOm May 29, 2024 10:08
@jsartisan jsartisan force-pushed the fix/checkbox-asterik branch from 6096b0c to 895c87c Compare May 30, 2024 04:55
@jsartisan jsartisan added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 30, 2024
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

Outside diff range and nitpick comments (2)
app/client/packages/design-system/widgets/src/components/Checkbox/chromatic/Checkbox.chromatic.stories.tsx (1)

Line range hint 22-29: Add unique keys to elements in the iterable to prevent potential issues with React's rendering.

- {states.map((state) => (
+ {states.map((state, index) => (
+   <React.Fragment key={index}>
    <>
      <DataAttrWrapper attr={state} key={state}>
        <Checkbox>unchecked {state}</Checkbox>
      </DataAttrWrapper>
      <DataAttrWrapper attr={state} key={state}>
        <Checkbox defaultSelected>checked {state}</Checkbox>
      </DataAttrWrapper>
    </>
+   </React.Fragment>
  ))}
app/client/packages/design-system/widgets/src/components/Checkbox/stories/Checkbox.stories.tsx (1)

Line range hint 56-57: Ensure that all icons used in the Checkbox component have appropriate alternative text for accessibility.

- <svg fill="currentColor" viewBox="0 0 24 24" {...props}>
+ <svg fill="currentColor" viewBox="0 0 24 24" {...props} aria-label="Checkmark">

@KelvinOm KelvinOm merged commit 01529c4 into release May 30, 2024
@KelvinOm KelvinOm deleted the fix/checkbox-asterik branch May 30, 2024 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Anvil Pod Issue related to Anvil project Bug Something isn't working High This issue blocks a user from building or impacts a lot of users ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog WDS team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Checkbox widget does not show an asterisk to indicate it's a required

3 participants