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(FwbDropdown): Add color prop to dropdown component #335

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

Conversation

tho-dan
Copy link

@tho-dan tho-dan commented Dec 5, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new color prop for the dropdown component, allowing users to customize button colors.
    • Added a new example showcasing dropdowns with various color options.
  • Documentation

    • Enhanced the dropdown documentation with improved formatting and a new section on button colors.
    • Reformatted the API section for better clarity and alignment.
  • Bug Fixes

    • Minor styling adjustments to ensure consistency in dropdown transitions.

Copy link

coderabbitai bot commented Dec 5, 2024

Walkthrough

The pull request introduces modifications to the dropdown component's documentation and implementation. Key changes include the addition of a new Vue component demonstrating dropdowns with various color options, updates to the dropdown documentation for improved clarity, and enhancements to the FwbDropdown component by adding a color prop. The documentation now includes a section for button colors, and the API section has been reformatted for better readability.

Changes

File Change Summary
docs/components/dropdown.md Updated formatting, added "Dropdown - Button colors" section, reformatted API section for clarity.
docs/components/dropdown/examples/FwbDropdownExampleColors.vue New component showcasing dropdowns with various color options and consistent layout.
src/components/FwbDropdown/FwbDropdown.vue Added color prop with default value, updated event emission syntax, and minor styling adjustments.

Possibly related PRs

  • chore: Update dropdown placement and alignment #313: This PR updates the documentation for the dropdown component, specifically modifying the text and placement properties, which relates to the changes made in the main PR regarding the dropdown documentation and its formatting.

Poem

🐰 In the meadow, colors bright,
Dropdowns dance in pure delight.
With hues of pink and shades of green,
A vibrant feast, a joyful scene.
Buttons gleam, oh what a sight,
Hopping forth, we share the light! 🌈


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 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 Dec 5, 2024

Deploy Preview for sensational-seahorse-8635f8 ready!

Name Link
🔨 Latest commit d2c25a9
🔍 Latest deploy log https://app.netlify.com/sites/sensational-seahorse-8635f8/deploys/67567ea5c32a1d00087ec504
😎 Deploy Preview https://deploy-preview-335--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: 1

🧹 Outside diff range and nitpick comments (1)
docs/components/dropdown.md (1)

202-238: Consider expanding the code examples

While the new button colors section is comprehensive, the use of ellipsis (...) in the code examples might not be clear enough for users. Consider showing at least one complete dropdown content example.

Example improvement:

 <fwb-dropdown text="Default" color="default">
-    ...
+    <div class="w-52">
+      <p class="p-2">Example content</p>
+    </div>
 </fwb-dropdown>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 79b0c19 and ab467d9.

📒 Files selected for processing (3)
  • docs/components/dropdown.md (3 hunks)
  • docs/components/dropdown/examples/FwbDropdownExampleColors.vue (1 hunks)
  • src/components/FwbDropdown/FwbDropdown.vue (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • docs/components/dropdown/examples/FwbDropdownExampleColors.vue
🧰 Additional context used
🪛 Markdownlint (0.35.0)
docs/components/dropdown.md

303-303: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🔇 Additional comments (5)
src/components/FwbDropdown/FwbDropdown.vue (4)

9-9: LGTM: Color prop binding is correctly implemented

The color prop is properly bound to the FwbButton component, enabling button color customization as intended.


53-53: LGTM: Color prop is well-defined

The color prop is properly typed using ButtonVariant and has a sensible default value of 'default'.

Also applies to: 65-65, 73-73


81-91: LGTM: Event handling improvements

The event emission syntax is more explicit and the watch function's formatting enhances readability.


135-142: LGTM: CSS transition formatting improvements

The transition classes have been reformatted for better readability while maintaining the same functionality.

Also applies to: 148-155, 161-168, 174-181

docs/components/dropdown.md (1)

2-5: LGTM: Import statement formatting is consistent

Added semicolons to import statements for better consistency with JavaScript/TypeScript conventions.

Comment on lines 303 to 309
| Name | Values | Default |
|-------------|---------------------|------------|
| placement | `DropdownPlacement` | `'bottom'` |
| text | `string` | `''` |
| transition | `string` | `''` |
| closeInside | `boolean` | `false` |
| alignToEnd | `boolean` | `false` |
Copy link

@coderabbitai coderabbitai bot Dec 5, 2024

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add missing color prop documentation

The color prop is missing from the props table in the API section. Please add it to maintain complete documentation.

Add this row to the props table:

 | Name        | Values              | Default    |
 |-------------|---------------------|------------|
+| color       | `ButtonVariant`     | `'default'`|
 | placement   | `DropdownPlacement` | `'bottom'` |
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| Name | Values | Default |
|-------------|---------------------|------------|
| placement | `DropdownPlacement` | `'bottom'` |
| text | `string` | `''` |
| transition | `string` | `''` |
| closeInside | `boolean` | `false` |
| alignToEnd | `boolean` | `false` |
| Name | Values | Default |
|-------------|---------------------|------------|
| color | `ButtonVariant` | `'default'`|
| placement | `DropdownPlacement` | `'bottom'` |
| text | `string` | `''` |
| transition | `string` | `''` |
| closeInside | `boolean` | `false` |
| alignToEnd | `boolean` | `false` |
🧰 Tools
🪛 Markdownlint (0.35.0)

303-303: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

Copy link
Collaborator

Choose a reason for hiding this comment

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

as CodeRabbitAI said... let's add color prop to this table.

Copy link

Choose a reason for hiding this comment

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

@Sqrcz, here's the updated props table with the color prop added:

| Name        | Values              | Default    |
|-------------|---------------------|------------|
| color       | `ButtonVariant`     | `'default'` |
| placement   | `DropdownPlacement` | `'bottom'`  |
| text        | `string`            | `''`        |
| transition  | `string`            | `''`        |
| closeInside | `boolean`           | `false`     |
| alignToEnd  | `boolean`           | `false`     |

This addition will ensure the color prop is properly documented in the API section.

@Sqrcz Sqrcz self-assigned this Dec 6, 2024
Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

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

Thank you for your input.

Please fix those few small issues and it'll be ready to merge.

Comment on lines 2 to 5
import FwbDropdownExamplePlacement from './dropdown/examples/FwbDropdownExamplePlacement.vue';
import FwbDropdownExampleAlignment from './dropdown/examples/FwbDropdownExampleAlignment.vue';
import FwbDropdownExampleListGroup from './dropdown/examples/FwbDropdownExampleListGroup.vue';
import FwbDropdownExampleTrigger from './dropdown/examples/FwbDropdownExampleTrigger.vue';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hey,
We're missing here import of FwbDropdownExampleColors for the new example to work properly.

Also we're missing FwbDropdoenExampleCloseInside import here... and please remove semicolons as we're not using them in the project.

Copy link
Author

Choose a reason for hiding this comment

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

The close inside example is fixed in #333

I corrected the other suggestions - thanks for pointing them out! I'll make sure I got the right code style in the future (my IDE suggested these changes, but I'll take extra care that it will be consistent from now on)

Comment on lines 303 to 309
| Name | Values | Default |
|-------------|---------------------|------------|
| placement | `DropdownPlacement` | `'bottom'` |
| text | `string` | `''` |
| transition | `string` | `''` |
| closeInside | `boolean` | `false` |
| alignToEnd | `boolean` | `false` |
Copy link
Collaborator

Choose a reason for hiding this comment

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

as CodeRabbitAI said... let's add color prop to this table.

@tho-dan tho-dan requested a review from Sqrcz December 9, 2024 05:22
@tho-dan
Copy link
Author

tho-dan commented Dec 9, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Dec 9, 2024

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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/dropdown.md (2)

203-239: Consider showing complete dropdown content in the example

While the example effectively demonstrates the color variants, using ellipsis (...) might make it harder for users to copy and adapt the code. Consider showing at least one complete dropdown content example.

 <template>
   <fwb-dropdown text="Default" color="default">
-    ...
+    <div class="w-52">
+      <p class="p-2">Dropdown content</p>
+    </div>
   </fwb-dropdown>
   <fwb-dropdown text="Alternative" color="alternative">
     ...
   </fwb-dropdown>
   <!-- remaining dropdowns -->
 </template>

304-311: Add blank lines around the props table

To improve readability and comply with markdown best practices, add blank lines before and after the table.

 ### Props
+
 | Name        | Values              | Default     |
 |-------------|---------------------|-------------|
 | placement   | `DropdownPlacement` | `'bottom'`  |
 | text        | `string`            | `''`        |
 | color       | `ButtonVariant`     | `'default'` |
 | transition  | `string`            | `''`        |
 | closeInside | `boolean`           | `false`     |
 | alignToEnd  | `boolean`           | `false`     |
+
 ### Events
🧰 Tools
🪛 Markdownlint (0.35.0)

304-304: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ab467d9 and d2c25a9.

📒 Files selected for processing (1)
  • docs/components/dropdown.md (3 hunks)
🧰 Additional context used
🪛 Markdownlint (0.35.0)
docs/components/dropdown.md

304-304: null
Tables should be surrounded by blank lines

(MD058, blanks-around-tables)

🔇 Additional comments (1)
docs/components/dropdown.md (1)

5-5: LGTM: Import statement follows existing pattern

The new import for FwbDropdownExampleColors is correctly placed and follows the established pattern.

Copy link
Collaborator

@Sqrcz Sqrcz left a comment

Choose a reason for hiding this comment

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

Thank you for the changes. 👍

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