Skip to content

feat: add vaadin version as CSS classname#148

Merged
paodb merged 1 commit intomasterfrom
vaadin-version-classname
Mar 2, 2026
Merged

feat: add vaadin version as CSS classname#148
paodb merged 1 commit intomasterfrom
vaadin-version-classname

Conversation

@javier-godoy
Copy link
Member

@javier-godoy javier-godoy commented Mar 2, 2026

Add a CSS classname derived from Vaadin version (demos-v24, demos-v25) for version-specific adjustments in add-ons demos.

Summary by CodeRabbit

  • Chores
    • Enhanced demo component with version-based class name support, enabling version-specific styling capabilities for better compatibility across different Vaadin versions.

@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

Walkthrough

A single file modification that imports Vaadin's Version class and augments the demo component with a runtime CSS class name containing the major Vaadin version during router layout content display. No public API changes or control flow alterations beyond the new class name injection.

Changes

Cohort / File(s) Summary
Version-based CSS class injection
src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java
Added Version import and runtime CSS class augmentation appending "demos-v" followed by major Vaadin version to the demo component's class list in showRouterLayoutContent method.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • mlopezFC
  • paodb
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding a Vaadin version as a CSS classname to the demo component, which matches the changeset modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch vaadin-version-classname

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 2, 2026

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.

🧹 Nitpick comments (1)
src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java (1)

215-215: Prefer setting the version class on the layout root once.

At Line 215 the class is added to each routed demo, which limits selectors to demo content and skips shared shell elements (tabs/footer). Consider adding it once to TabbedDemo instead.

♻️ Proposed refactor
@@ public TabbedDemo() {
-    setSizeFull();
+    addClassName("demos-v" + Version.getMajorVersion());
+    setSizeFull();
@@ public void showRouterLayoutContent(HasElement content) {
-    demo.addClassName("demos-v" + Version.getMajorVersion());
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java` at line
215, Currently each routed demo calls demo.addClassName("demos-v" +
Version.getMajorVersion()) which applies the version CSS class only to demo
content; move the responsibility to the layout root by adding this class once in
the TabbedDemo constructor (or initialization path) instead of per-demo, and
remove the demo.addClassName call from wherever demos are created; update code
that references demo.addClassName to use TabbedDemo (the root component) so
shared shell elements (tabs/footer) receive the version class.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java`:
- Line 215: Currently each routed demo calls demo.addClassName("demos-v" +
Version.getMajorVersion()) which applies the version CSS class only to demo
content; move the responsibility to the layout root by adding this class once in
the TabbedDemo constructor (or initialization path) instead of per-demo, and
remove the demo.addClassName call from wherever demos are created; update code
that references demo.addClassName to use TabbedDemo (the root component) so
shared shell elements (tabs/footer) receive the version class.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 827450a and 95ffa05.

📒 Files selected for processing (1)
  • src/main/java/com/flowingcode/vaadin/addons/demo/TabbedDemo.java

@javier-godoy javier-godoy requested review from mlopezFC and paodb March 2, 2026 17:03
@javier-godoy javier-godoy marked this pull request as ready for review March 2, 2026 17:03
@paodb paodb merged commit 5142da3 into master Mar 2, 2026
3 checks passed
@paodb paodb deleted the vaadin-version-classname branch March 2, 2026 17:10
@github-project-automation github-project-automation bot moved this from To Do to Pending release in Flowing Code Addons Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pending release

Development

Successfully merging this pull request may close these issues.

2 participants