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: FwbInput: Split input and block classes #325

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andreyjamer
Copy link
Contributor

@andreyjamer andreyjamer commented Sep 17, 2024

Sometimes it is required to add some customization to the input or the input wrapper. Currently it is impossible: class attribute value for is added both for the input and for the input wrapper block.
This PR fixes the issue and introduces a separate property to control wrapper only classes

Summary by CodeRabbit

  • New Features

    • Enhanced input component documentation with support for custom CSS classes.
    • Introduced a new example component showcasing customizable input styling.
    • Added a new prop for dynamic class binding on the input component's wrapper.
  • Bug Fixes

    • Improved attribute management to prevent automatic inheritance from parent components.
  • Documentation

    • Updated documentation to clarify the use of the new block-classes property and provide usage examples.

Copy link

coderabbitai bot commented Sep 17, 2024

Walkthrough

The pull request introduces enhancements to the FwbInput component by adding a new property, blockClasses, which allows users to apply custom CSS classes to the input wrapper. A new example component, FwbInputExampleBlockClasses, is added to demonstrate this feature, showcasing a styled input field. The documentation for the input component is updated to reflect these changes, providing clarity on the new customization options.

Changes

Files Change Summary
docs/components/input.md Added documentation for blockClasses property and introduced FwbInputExampleBlockClasses example.
docs/components/input/examples/FwbInputExampleBlockClasses.vue Created a new Vue component demonstrating the use of FwbInput with custom styles.
src/components/FwbInput/FwbInput.vue Introduced blockClasses prop for dynamic class binding on the outer <div>; updated class binding.

Possibly related PRs

  • Add autocomplete property #285: The changes in this PR also modify the FwbInput.vue file, specifically the InputProps interface, which is relevant to the main PR's updates to the same file, enhancing the input component's configurability.

🐰 In the garden where inputs bloom,
A new class brings style to the room.
With borders and padding, oh what a sight,
Custom designs make everything right!
Hop along now, let’s code with glee,
For FwbInput shines, as bright as can be! 🌼


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between dca9134 and e310713.

Files selected for processing (1)
  • docs/components/input.md (2 hunks)
Additional context used
LanguageTool
docs/components/input.md

[uncategorized] ~110-~110: A comma might be missing here.
Context: ...e input element. To customize the input wrapper you can use the block-classes propert...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

Markdownlint
docs/components/input.md

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Additional comments not posted (2)
docs/components/input.md (2)

107-133: Documentation looks good!

The new "Extra CSS classes" section clearly explains the purpose and usage of the block-classes property. The example component FwbInputExampleBlockClasses is referenced to demonstrate the feature.

Tools
LanguageTool

[uncategorized] ~110-~110: A comma might be missing here.
Context: ...e input element. To customize the input wrapper you can use the block-classes propert...

(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)

Markdownlint

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


113-132: The example component looks good!

The FwbInputExampleBlockClasses component correctly demonstrates the usage of the block-classes property to customize the input wrapper. It applies custom styles to the wrapper while using the class attribute to style the input element itself. The example aligns well with the documentation.

Tools
Markdownlint

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


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 generate interesting stats about this repository and render them as a table.
    -- @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 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

netlify bot commented Sep 17, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit e310713
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/66e99907b4fa5b0008b0708b
😎 Deploy Preview https://deploy-preview-325--sensational-seahorse-8635f8.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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

Outside diff range and nitpick comments (2)
docs/components/input.md (2)

107-132: Documentation looks good, but please address the grammatical issues.

The new section "Extra CSS classes" provides clear instructions on how to customize the input and input wrapper using the class and block-classes attributes. The example code aligns well with the explanation.

However, please address the following grammatical issues:

  • Line 109: Add a comma after "By default".
  • Line 110: Replace "an" with "can".
  • Line 110: Add "the" before "values".

Apply this diff to fix the grammatical issues:

- By default `class` attibute is bind to the input element. To customize the input wrapper you an use `block-classes` property.
- It accepts the values as `class` attribute
+ By default, `class` attribute is bound to the input element. To customize the input wrapper you can use the `block-classes` property.
+ It accepts the values as the `class` attribute
Tools
LanguageTool

[uncategorized] ~109-~109: Did you mean: “By default,”?
Context: ...tion to the input or the input wrapper. By default class attibute is bind to the input e...

(BY_DEFAULT_COMMA)


[misspelling] ~110-~110: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...ent. To customize the input wrapper you an use block-classes property. It accept...

(EN_A_VS_AN)


[uncategorized] ~110-~110: You might be missing the article “the” here.
Context: ... customize the input wrapper you an use block-classes property. It accepts the ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

Markdownlint

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


132-132: Please specify the language for the fenced code block.

To improve syntax highlighting and readability, it's a best practice to specify the language for fenced code blocks in markdown.

Based on the content, please add the language specifier "vue" to the code block:

- ```
+ ```vue
Tools
Markdownlint

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c679aa9 and dca9134.

Files selected for processing (3)
  • docs/components/input.md (2 hunks)
  • docs/components/input/examples/FwbInputExampleBlockClasses.vue (1 hunks)
  • src/components/FwbInput/FwbInput.vue (3 hunks)
Additional context used
LanguageTool
docs/components/input.md

[uncategorized] ~109-~109: Did you mean: “By default,”?
Context: ...tion to the input or the input wrapper. By default class attibute is bind to the input e...

(BY_DEFAULT_COMMA)


[misspelling] ~110-~110: Use “a” instead of ‘an’ if the following word doesn’t start with a vowel sound, e.g. ‘a sentence’, ‘a university’.
Context: ...ent. To customize the input wrapper you an use block-classes property. It accept...

(EN_A_VS_AN)


[uncategorized] ~110-~110: You might be missing the article “the” here.
Context: ... customize the input wrapper you an use block-classes property. It accepts the ...

(AI_EN_LECTOR_MISSING_DETERMINER_THE)

Markdownlint
docs/components/input.md

132-132: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

Additional comments not posted (8)
docs/components/input/examples/FwbInputExampleBlockClasses.vue (2)

1-11: LGTM!

The template structure and usage of the <fwb-input> component are correct. The v-model binding, label, placeholder, and custom styling attributes are used appropriately.


13-18: LGTM!

The script section imports the necessary dependencies and creates a reactive variable name correctly. The usage of the ref function and the initialization of name with an empty string are appropriate for capturing user input.

src/components/FwbInput/FwbInput.vue (4)

2-2: LGTM!

The change to use the blockClasses prop for dynamic class binding on the outer <div> is a good improvement. It enhances the component's flexibility by allowing users to specify custom classes for styling purposes.


67-67: LGTM!

The new blockClasses prop has been correctly added to the InputProps interface with a flexible type that allows for a string, an array of strings, or a record of string keys and unknown values. This is consistent with the usage in the template.


70-72: LGTM!

The introduction of the defineOptions function to set inheritAttrs to false is a good practice. It prevents the component from automatically inheriting attributes from its parent, allowing for more controlled attribute management and preventing unintended attribute inheritance.


83-83: LGTM!

The addition of the blockClasses prop to the withDefaults function with an undefined default value is consistent with the prop declaration in the InputProps interface. This makes the prop optional, which is appropriate for its intended usage.

docs/components/input.md (2)

6-6: LGTM!

The import statement for the new example component FwbInputExampleBlockClasses looks good.


113-131: Example code looks good!

The example code effectively demonstrates how to use the class and block-classes attributes to customize the input and input wrapper. The code is syntactically correct and aligns well with the explanation.

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