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(#132): add name and passthru props #133

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Conversation

Decipher
Copy link
Member

@Decipher Decipher commented Jan 11, 2024

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Adds name and passthru props to CTFormElements and relevant components.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

Screenshots/Media:

Summary by CodeRabbit

  • New Features
    • Enhanced form elements (checkboxes, radio buttons, dropdowns, text fields, and text areas) with additional attribute bindings and name properties for improved accessibility and form handling.

Copy link

coderabbitai bot commented Jan 11, 2024

Walkthrough

The recent updates to the Vue components involve enhancing form elements to inherit attributes dynamically with $attrs and to handle a name property. This allows for better customization and control over form elements, ensuring they can be more easily integrated into forms with named data handling.

Changes

Files Change Summary
src/components/Checkbox.vue
src/components/Radio.vue
src/components/Select.vue
Added v-bind="$attrs" to input/select elements and name prop to components.
src/components/FormElement.vue Added name attribute to input elements and name prop to component.
src/components/Textarea.vue
src/components/Textfield.vue
Added v-bind="$attrs" directive to input/textarea elements and name prop to components.

🐇✨
In a field of code, under moon's soft glow,
A rabbit hopped through, with updates in tow.
With $attrs bound, and name props set,
Forms now dance with grace, the finest yet! 🌟📝

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-tests for this file.
  • 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 tests 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 from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between de4bae8 and 84d3d72.
Files selected for processing (6)
  • src/components/Checkbox.vue (2 hunks)
  • src/components/FormElement.vue (2 hunks)
  • src/components/Radio.vue (2 hunks)
  • src/components/Select.vue (2 hunks)
  • src/components/Textarea.vue (2 hunks)
  • src/components/Textfield.vue (2 hunks)
Additional comments: 16
src/components/Radio.vue (2)
  • 11-15: The addition of v-bind="$attrs" and :name="name" to the input element is a good practice for allowing arbitrary attributes to be passed to the component and binding the name attribute to the input element. Ensure that the name prop is being passed wherever this component is used.

  • 33-36: The name prop has been correctly added with a default value of undefined. This is a good practice as it allows the component to function without a name if it's not provided. However, consider if a default value is necessary or if it should be required without a default.

src/components/Textarea.vue (2)
  • 4-10: The use of v-bind="$attrs" to pass all attributes to the textarea element is a good practice for Vue.js components, allowing for greater flexibility. The addition of the :name="name" binding is also correct, enabling the name attribute to be set on the textarea element.

  • 28-31: The name prop has been added with a type of String and a default value of undefined. This is consistent with the changes in other components and allows for optional usage of the name attribute.

src/components/Select.vue (2)
  • 4-12: The addition of v-bind="$attrs" to the <select> element is a good practice, allowing for arbitrary attributes to be passed to the select element. The :name="name" binding is correctly added to enable the name attribute on the select element.

  • 35-38: The name property has been added with a type of String and a default value of undefined. This is consistent with the changes in other components and allows for optional usage of the name attribute.

src/components/Textfield.vue (2)
  • 4-12: The use of v-bind="$attrs" to pass all attributes to the input element is a good practice for Vue.js components, allowing for greater flexibility. The addition of the :name="name" binding is also correct, enabling the name attribute to be set on the input element.

  • 28-31: The name prop has been added with a type of String and a default value of undefined. This is consistent with the changes in other components and allows for optional usage of the name attribute.

src/components/Checkbox.vue (2)
  • 12-15: The addition of v-bind="$attrs" to the input element is a good practice, allowing for arbitrary attributes to be passed to the checkbox component. The :name="name" binding is correctly added to enable the name attribute on the input element.

  • 50-53: The name prop has been added with a type of String and a default value of undefined. This is consistent with the changes in other components and allows for optional usage of the name attribute.

src/components/FormElement.vue (6)
  • 24-24: The v-bind directive is used correctly to pass down the id, name, placeholder, required, type, and other attributes to the CTTextfield component. This is a good practice for reusability and flexibility of the component.

  • 31-31: The v-bind directive is used correctly to pass down the id, name, placeholder, required, and other attributes to the CTTextarea component. This is a good practice for reusability and flexibility of the component.

  • 38-38: The v-bind directive is used correctly to pass down the error, id, name, options, placeholder, required, and other attributes to the CTSelect component. This is a good practice for reusability and flexibility of the component.

  • 45-45: The v-bind directive is used correctly to pass down the id, name, placeholder, required, and other attributes to the CTRadio component. This is a good practice for reusability and flexibility of the component.

  • 52-52: The v-bind directive is used correctly to pass down the id, label, name, placeholder, required, and other attributes to the CTCheckbox component. This is a good practice for reusability and flexibility of the component.

  • 102-105: The name prop has been added with a type of String and a default value of undefined. This is consistent with the changes in other components and allows for optional usage of the name attribute. Ensure that the name prop is being passed wherever this component is used.

@Decipher Decipher merged commit 4662ba5 into develop Jan 11, 2024
3 checks passed
@Decipher Decipher deleted the feature/132-name_passthru branch January 11, 2024 22:29
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