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

updated checkbox component - removed customlabelmarkup #187

Merged
merged 2 commits into from
Jan 23, 2025

Conversation

Swathi-eGov
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jan 23, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • react/example/package.json is excluded by !**/*.json
  • react/package.json is excluded by !**/*.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The pull request involves removing the customLabelMarkup prop from the CheckBox component across multiple files in the React UI components. This change simplifies the label rendering logic by removing a specific conditional rendering approach for checkbox labels. The modifications are consistent across different components like CheckBox, TableCell, FieldComposer, FieldV1, and Fields, indicating a systematic removal of this prop throughout the application.

Changes

File Change Summary
react/ui-components/src/atoms/CheckBox.js Removed customLabelMarkup prop and simplified label rendering logic
react/ui-components/src/atoms/TableCell.js Removed customLabelMarkup prop from CheckBox component rendering
react/ui-components/src/hoc/FieldComposer.js Removed customLabelMarkup prop from checkbox rendering, simplified method signature
react/ui-components/src/hoc/FieldV1.js Removed customLabelMarkup prop from CheckBox component
react/ui-components/src/hoc/Fields.js Removed customLabelMarkup prop from checkbox case in switch statement

Poem

🐰 A Checkbox's Label, Once Complex
Custom markup, now we've stripped
Simplicity reigns, no extra flips
Just pure text, clean and crisp
A rabbit's code, now neatly clipped! 🏷️


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.

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 (2)
react/ui-components/src/atoms/CheckBox.js (2)

Line range hint 9-96: Consider accessibility and testing improvements.

While the changes look good, here are some suggestions to enhance the component:

  1. Add aria-label for better screen reader support
  2. Consider adding a data-testid prop for easier testing
  3. Add JSDoc comments for the remaining props

Here's how you could implement these improvements:

 const CheckBox = ({
   onChange,
   label,
   value,
   disabled,
   ref,
   checked,
   inputRef,
   pageType,
   style,
   index,
   isLabelFirst,
   hideLabel,
   isIntermediate,
+  'data-testid': dataTestId,
   ...props
 }) => {
   // ...
         <input
           type="checkbox"
           className={`input ${userType === "employee" ? "input-emp" : ""} ${props?.inputClassName} `}
           onChange={onChange}
           value={value || label}
+          aria-label={sentenceCaseLabel}
+          data-testid={dataTestId}
           {...props}
           ref={inputRef}
           disabled={disabled}
           checked={checked}
         />

Line range hint 75-96: Document remaining props in PropTypes.

Several props are used but not documented in PropTypes:

  • disabled
  • checked
  • isLabelFirst
  • style
  • pageType

Add these to PropTypes with appropriate JSDoc comments:

 CheckBox.propTypes = {
   /**
    * CheckBox content
    */
   label: PropTypes.string.isRequired,
   /**
    * onChange func
    */
   onChange: PropTypes.func,
   /**
    * input ref
    */
   ref: PropTypes.func,
   userType: PropTypes.string,
   hideLabel:PropTypes.bool,
   isIntermediate: PropTypes.bool,
+  /**
+   * Disables the checkbox
+   */
+  disabled: PropTypes.bool,
+  /**
+   * Controls the checked state
+   */
+  checked: PropTypes.bool,
+  /**
+   * Controls label position
+   */
+  isLabelFirst: PropTypes.bool,
+  /**
+   * Additional styles
+   */
+  style: PropTypes.object,
+  /**
+   * Page type for styling
+   */
+  pageType: PropTypes.string,
 };
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c5dc7a8 and 9546877.

⛔ Files ignored due to path filters (6)
  • react/example/package.json is excluded by !**/*.json
  • react/modules/Project/package.json is excluded by !**/*.json
  • react/modules/core/package.json is excluded by !**/*.json
  • react/modules/sample/package.json is excluded by !**/*.json
  • react/package.json is excluded by !**/*.json
  • react/ui-components/package.json is excluded by !**/*.json
📒 Files selected for processing (5)
  • react/ui-components/src/atoms/CheckBox.js (2 hunks)
  • react/ui-components/src/atoms/TableCell.js (0 hunks)
  • react/ui-components/src/hoc/FieldComposer.js (0 hunks)
  • react/ui-components/src/hoc/FieldV1.js (0 hunks)
  • react/ui-components/src/hoc/Fields.js (0 hunks)
💤 Files with no reviewable changes (4)
  • react/ui-components/src/hoc/FieldV1.js
  • react/ui-components/src/atoms/TableCell.js
  • react/ui-components/src/hoc/Fields.js
  • react/ui-components/src/hoc/FieldComposer.js
🔇 Additional comments (1)
react/ui-components/src/atoms/CheckBox.js (1)

42-42: LGTM! Label rendering simplified.

The removal of customLabelMarkup in favor of direct sentenceCaseLabel rendering improves code maintainability while maintaining consistent label display.

Also applies to: 70-70

@jagankumar-egov jagankumar-egov merged commit 3cb73b1 into develop Jan 23, 2025
1 check passed
@coderabbitai coderabbitai bot mentioned this pull request Jan 23, 2025
jagankumar-egov added a commit that referenced this pull request Feb 20, 2025
* added selectioncard css change (#107)

* Dpg 2443  [0.0.2-beta.20] - 2024-08-02 ### Added -  Added css for Tag Component (#108)

* added tag component

* updated versions

* updated with review changes

* added iconRender logic

* updated tooltip (#109)

* updated tooltip

* review changes

* updated the user type fetch logic

* updated versions

* resolved version issue

* resolved version issue

* added flex parameter to the value pair list

* Dpg 2312 (#110)

* added switch and bottomsheet components

* updated versions

* added review changes

* added flex parameter to the value pair list

* added flex parameter to the value pair list

* added a max line for toast and added focus node for textfield also

* added accordian switch and bottom sheet

* added accordian switch and bottom sheet

* added color property to override suffix icon color

* adding code view plugin to storybook

* added code preview for these component in story

* fixed some css color related issues of old components

* Svg accordion sidebar updates (#111)

* added accordion

* updated sidebar

* updated svgs

* updated versions

* fixed css issue

* updated switch and bottom sheet

* updated tab component

* added switch theme

* fixing toast issue and typography issue

* fixed mobilesidebar issue

* updated sidebar and added accordion wrapper

* updated mobilesidebar css

* updated sidebar and added accordion wrapper (#115)

* updated sidebar and added accordion wrapper

* updated mobilesidebar css

* fixed sidebar issue

* updated mobilesidebar

* updated sidebar and hambuger

* added dark theme

* added localization

* updated tooltip with header and description

* updating localization

* updating localization

* added bottomsheet with its draggable functionality

* Added Accordion Animation

* added landingpagecard and wrapper components

* added menucard and its wrapper components

* sidebar-changes

* updated versions

* updated stories

* topbar height update

* Selection card update (#124)

* updated selectioncard

* updated versions

* css issue fix-updated css version for components (#125)

* updated  dependencies of ui component library

* updated versions

* build

* rename same animation name (#127)

* rename same animation name

* version update

---------

Co-authored-by: NabeelAyubee <nayubi7@gmail.com>

* React component changes (#126)

* added tab component

* added search functionality for multiselectdropdown

* updated landingpagecard

* added hover state for menucard

* updated stepper

* updated preselected label color for radio btns

* added stories for color and spacers

* updated sidebar

* enhancements

* uodated versions

* review changes

* added long text stories

* default value for allowMultipleOpen

* updated versions

* updated tab styles

* updated animation name

* added review changes

* updated version

* updated git comments

* updated table component

* updated matrix card

* updated menu card

* updated override file

* Component enhancements react (#129)

* added configuration to remove close icon in chip

* added chipsKey as configuration for dropdown chips

* fixes

* updated versions

* updated override file

* updated landing page card and selection card story

* updated landing page card and selection card story

* fixed table issues

* fixed table issues

* updated util function

* updated selection card and landing page card

* added otpinput and css changes for landingpagecard (#130)

* updated selection card and landing page card

* updated selection card and landing page card

* resolved code-rabbit comments

* updated tooltip component

* fixed file upload issue

* adding form card component

* added filter card component

* updated table and filter card component

* updated slider component

* adding localisation for info

* Table molecule (#131)

* added table molecule

* updated versions

* review changes

* updated typography

* added review changes

* updated breadcrumb

* updated otpinput

* updated accordion

* added intermediate state for checkbox

* updated icon css in hamburger

* added metric card component

* updated table molecule props

* added accessor for headerData

* updated formcard

* added review changes

* ui components version update

* updated table component

* updated table component

* updated table component

* updated slider, form card and divider component

* updated slider, form card and divider component

* New react components (#133)

* added nestedTable, filtercard and formcards

* updated versions

* updated stories (#134)

* updated flutter version

* added foundation library to storybook

* added iframe widget

* Added MaterialUI Icons,Updated Colors and Spacers Stories (#135)

* Added MaterialUI Icons,Updated Colors and Spacers Stories

* removed material icons dependency

* added shpicon in customsvgs (#136)

* added shpicon in customsvgs

* removed shpicon

* updated pr comments

* modified iframe widget

* updated radio story

* updated current branch with develop

* updated button, alert card and back button stories

* updated code rabbit comments

* updated style prop and added chip shadow (#138)

* updated lable value field story, selection card story and switch story

* updated lable value field story, selection card story and switch story

* added manual pagination (#140)

* added manual pagination

* added mdmsv2 handling in Customdrodpown

* updated timeline molecule and atom, added one more state as failure

* updated timeline molecule and language page card story

* storybook audit fixes for typography,hamburger and sidebar (#142)

* storybook audit fixes for typography,hamburger and sidebar

* updated breadcrumb

* updated breadcrumb story

* updated isLast function

* fixed build issue

* fixed timeline step not showing issue

* Build component issue check(#145)

* storybook fixes (#146)

* storybook fixes

* Update react/ui-components/src/atoms/stories/Accordion.stories.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* build issue fix (#147)

* build issue fix

* updated components version

* updated paste and backspace logic  for OTP Input (#148)

* added support for external link navigation (#149)

* added support for external link navigation

* Fixed Navigation redirection for landing page card if it is an external url.

* added privacy component

* added initial visible elements as a prop in timeline (#150)

* added the changes of the id for every field

* revert back the librraies version

* Update package.json

* Updated privacy policy component

* Updated Package version to 0.0.2-dev.2

* reverting to original libraries version (#154)

* Updated loader component

* updated dependency versions

* updated dependency versions

* updated dependency versions

* updated dependency versions

* updated lottie versions

* removed required from back button label

* changed custom popup return type from bool to dynamic

* updated label max char condition

* updated stories, added docs story for all components, added loader co… (#156)

* updated stories, added docs story for all components, added loader component

* updated title

* added Iframe component

* updated label and menu card

* published a new version

* fixed year and month calculation from date

* fixed year and month calculation from date

* fixed year and month calculation from date and published new version

* fixed matric card

* Storybook updates

* Storybook updates

* Storybook updates on audit points

* added classname and totalCount props in Table

* storybook audit fixes-1 (#163)

* fixed totalCount issue

* updated pop up stories

* Switch component checked issue fix (#165)

* HCMPRE-1766: fixes Switch component checked issue

* version update

---------

Co-authored-by: NabeelAyubee <nayubi7@gmail.com>

* updated toast offset default

* updated dropdown on default value

* fixed sync dialog util function

* updated label for sync dialog

* fixed powered by image

* fixed powered by image

* updated theme and added footer

* fixed sync dialog

* updated toast

* published a new version with the changes required for main app integration

* reverted override to github

* version updates

* updated css

* updated css and inboxserachcomposer

* fixed table not taking all width issue

* updated error message in privacy component

* fixed powered by digit logo loading issue

* updated version of digit component

* updates

* updated versions and other fixes

* removed libraries modules. Updated local running flow

* Create .gitignore

* updates

* updated gitignore files

* updated component version

* updated checkbox component - removed customlabelmarkup (#187)

* Checkbox update (#189)

* updated checkbox component - removed customlabelmarkup

* updated to label tag

* updated label for to be dynamic based on the id

* Updated id for text dropdwon

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>

* Fixed Storybook audit points (#191)

* fixed language selection card alignment issue

* fixed utils dialog alignment issue

* fixed language card padding

* publish a new version with issues fixes

* added property to disabled sentence case in dropdown

* added property to disabled sentence case in dropdown

* fixed table null exception issue

* fixed app integration issue

* fixed stepper length issue

* fixed sidebar not trigger rebuild on change language

* fixed sidebar not trigger rebuild on change language

* published a new version

* added content padding for pop up card

* fixed dropdown text not getting clear after rerender

* Added id for checkbox input (#218)

* fixed stepper alignment issue

* Updated table, summary card and published new version

* Update digit_table.dart

* updated Readme file

* updated doc link in stories

* updated images

* Updating the version and added documentation link (#223)

* Updating the version and added documentation link

* Updated the readme and changelog content

* updated the version script

---------

Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>

* Updated readme file

* Update introduction_story.dart

* Update README.md

* Updated documentation link (#225)

Co-authored-by: rachana-egov <rachana.singh@egovernment.org>

* Updated pub file

* resolved build config conflicts

* resolved conflicts

* updating the scripts

* Updated the branch details

---------

Co-authored-by: Swathi-eGov <137176788+Swathi-eGov@users.noreply.github.com>
Co-authored-by: Jagankumar <53823168+jagankumar-egov@users.noreply.github.com>
Co-authored-by: rachana-egov <rachana.singh@egovernment.org>
Co-authored-by: Swathi-eGov <swathi.chatrathi@egovernments.org>
Co-authored-by: nabeelmd-eGov <nabeel.md@egovernments.org>
Co-authored-by: NabeelAyubee <nayubi7@gmail.com>
Co-authored-by: Naveen J <83631045+naveen-egov@users.noreply.github.com>
Co-authored-by: Nipun Arora <aroranipun1@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.

2 participants