Skip to content

✨ 272 slider component - #357

Merged
langehm merged 23 commits into
betafrom
272-slider-component
Jan 8, 2025
Merged

✨ 272 slider component#357
langehm merged 23 commits into
betafrom
272-slider-component

Conversation

@lehju

@lehju lehju commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

Description

Add slider component

Reference

Issues #272

Summary by CodeRabbit

  • New Features

    • Introduced a new slider component (MucSlider) utilizing the Splide library for enhanced carousel functionality.
    • Added a slider item component (MucSliderItem) for customizable slide content.
    • Implemented Storybook configuration for visual representation of the MucSlider component.
  • Chores

    • Updated project dependencies to include @splidejs/vue-splide version 0.6.12.

@lehju lehju self-assigned this Dec 11, 2024
@lehju lehju linked an issue Dec 11, 2024 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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

Walkthrough

Ze project has undergone a significant enhancement by introducing a new slider component system. Ze changes include adding ze Splide library dependency, creating a MucSlider and MucSliderItem components, and updating ze component index files to expose zese new slider-related components. Ze implementation provides a flexible and reusable slider mechanism for ze application.

Changes

File Change Summary
package.json Added dependency @splidejs/vue-splide@0.6.12
src/components/Slider/... • Added MucSlider.vue - Main slider component
• Added MucSliderItem.vue - Individual slide component
• Added MucSlider.stories.ts - Storybook configuration
• Added index.ts - Component exports
src/components/index.ts Imported and exported new slider components

Sequence Diagram

sequenceDiagram
    participant User
    participant MucSlider
    participant MucSliderItem
    participant Splide Library

    User->>MucSlider: Interact with Slider
    MucSlider->>Splide Library: Initialize Slider
    Splide Library-->>MucSlider: Slider Ready
    User->>MucSlider: Navigate Slides
    MucSlider->>Splide Library: Change Slide
    Splide Library-->>MucSliderItem: Update Active Slide
Loading

Poem

Ach, ze slider rolls along,
Splide's magic makes it strong!
Components dance with glee,
A Vue carousel to see!
Mein engineering art complete,
Zis slider looks so neat! 🎠


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

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.

@lehju
lehju requested a review from FabianWilms December 17, 2024 14:58
@lehju
lehju marked this pull request as ready for review December 17, 2024 14:58
@FabianWilms

Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Dec 18, 2024

Copy link
Copy Markdown
Contributor
✅ 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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (4)
src/components/Slider/MucSliderItem.vue (1)

11-14: Ze slot documentation könnte be more descriptiv!

Ze current documentation ist very basic. Consider adding more details about:

  • Expected content types
  • Any size restrictions
  • Example usage
 /**
- * Elements can be put into this slot.
+ * Slot for slide content such as MucCard, images, or any other components.
+ * Content should maintain consistent dimensions for optimal display.
+ * @example
+ * <MucSliderItem>
+ *   <MucCard title="Example" />
+ * </MucSliderItem>
  */
src/components/Slider/MucSlider.stories.ts (1)

22-39: Ze template could use some improvements!

  1. Consider using :key with unique identifier instead of index:
-<MucSliderItem v-for="index in 5" :key="index">
+<MucSliderItem v-for="index in 5" :key="`slide-${index}`">
  1. Ze example ist very basic. Consider adding:
  • Different card variations
  • Different content types
  • Example with navigation options

Also, it vould be gut to add more stories showing different use cases:

export const WithImages = () => ({
  components: { MucSlider, MucSliderItem },
  template: `
    <MucSlider>
      <MucSliderItem v-for="index in 3" :key="'image-'+index">
        <img :src="'https://picsum.photos/400/300?random='+index" alt="Sample image" />
      </MucSliderItem>
    </MucSlider>
  `
});
src/components/Slider/MucSlider.vue (2)

9-13: Gut implementation of ze slider section!

Ze accessibility attributes sind very gut! However, ve could improve ze loading state handling.

Consider adding a loading state like zis:

 <section
   class="m-slider m-slider--visible-preview"
   aria-label="Slider mit Elementen"
+  :aria-busy="isLoading"
   data-m-slider-splide="m-slider-comment"
 >
+  <div v-if="isLoading" class="m-slider__loading">
+    Loading...
+  </div>

62-68: Ze event name could be more specific!

Ze 'changeSlide' event name ist a bit generic. In ze component library, ve should use more specific names.

Consider renaming like zis:

-  changeSlide: [index: number];
+  sliderIndexChange: [index: number];
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d044c17 and db65b8b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • package.json (1 hunks)
  • src/components/Slider/MucSlider.stories.ts (1 hunks)
  • src/components/Slider/MucSlider.vue (1 hunks)
  • src/components/Slider/MucSliderItem.vue (1 hunks)
  • src/components/Slider/index.ts (1 hunks)
  • src/components/index.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/components/Slider/index.ts
🔇 Additional comments (3)
src/components/Slider/MucSliderItem.vue (1)

1-5: Ze template structure looks gut!

Ze component correctly wraps ze SplideSlide component und provides a slot for content injection.

src/components/index.ts (1)

24-24: Ja, ze exports look ordentlich!

Ze new slider components are properly imported und exported, maintaining ze alphabetical order.

Also applies to: 52-53

package.json (1)

80-81: 🛠️ Refactor suggestion

Achtung! Ze version of @splidejs/vue-splide ist not ze latest!

Ze current version 0.6.12 ist quite old. Ze latest version ist 1.0.1 mit many improvements und bug fixes. Ve should upgrade, ja?

Let me check ze security advisories:

Comment thread src/components/Slider/MucSlider.stories.ts
Comment thread src/components/Slider/MucSlider.vue Outdated
Comment thread src/components/Slider/MucSlider.vue
@FabianWilms

Copy link
Copy Markdown
Member

@lehju I needed to use the fork-Version of vue-splide as the project isn't being actively maintained anymore (read more here Splidejs/vue-splide#92 (comment)).

The alternative was to use the node tool "patch-package" but that was definitely not a cleaner solution.

@langehm

langehm commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

@lehju I needed to use the fork-Version of vue-splide as the project isn't being actively maintained anymore (read more here Splidejs/vue-splide#92 (comment)).

The alternative was to use the node tool "patch-package" but that was definitely not a cleaner solution.

Should we even use a project like this if it is not actively maintained? What happens if we need to update some peer-dependencies ... are there other libraries we can consider?

@FabianWilms

FabianWilms commented Dec 20, 2024

Copy link
Copy Markdown
Member

are there other libraries we can consider?

There probably are, but we are forced to use it as this is what the MDE uses and we shouldn't be reinventing the wheel here.

In the long term, when MDE publishes the components as webcomponents we won't need to include the library in our lib anymore. For now it will be the best solution we have.

@langehm

langehm commented Dec 20, 2024

Copy link
Copy Markdown
Contributor

understandable

@langehm
langehm self-requested a review December 20, 2024 11:03
Comment thread src/components/Slider/MucSlider.vue
Comment thread src/components/Slider/MucSlider.vue
Comment thread src/components/Slider/MucSlider.vue Outdated
Comment thread src/components/Slider/MucSlider.vue Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jan 8, 2025
@langehm langehm changed the title 272 slider component ✨ 272 slider component Jan 8, 2025
@langehm
langehm merged commit d2b12b3 into beta Jan 8, 2025
@langehm
langehm deleted the 272-slider-component branch January 8, 2025 08:45
@github-actions

github-actions Bot commented Jan 8, 2025

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0-beta.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ "Slider"-Component

3 participants