Skip to content

[WEB-4725] chore: storybook setup & tailwind config package improvements#7614

Merged
sriramveeraghanta merged 9 commits intopreviewfrom
chore-propel-storybook-setup
Aug 25, 2025
Merged

[WEB-4725] chore: storybook setup & tailwind config package improvements#7614
sriramveeraghanta merged 9 commits intopreviewfrom
chore-propel-storybook-setup

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Aug 21, 2025

Description

This PR includes the following changes:

  • Integrated Storybook into the Propel package for component development and documentation
  • Added global CSS file to the common @plane/tailwind-config package
  • Introduced cn utility in the Propel package

Summary by CodeRabbit

  • New Features

    • Themeable design system with global CSS variables, Tailwind layers, UI utilities (scrollbars, inputs, overlays, progress, tags) for consistent light/dark themes.
    • Storybook added for interactive component preview and documentation, with dev and build scripts.
  • Chores

    • Linting updated to include Storybook rules.
    • Task runner updated to build Storybook outputs.
    • Repository ignore updated to exclude generated Storybook assets.
  • Refactor

    • Added a small class-name utility and a utils barrel for cleaner imports.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

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

Walkthrough

Adds Storybook to the propel package (configs, scripts, Turbo task, gitignore), introduces a classname utility and utils barrel, and adds a global Tailwind CSS theming file and related UI utilities.

Changes

Cohort / File(s) Change summary
Storybook config
packages/propel/.storybook/main.ts, packages/propel/.storybook/preview.ts
New Storybook config and preview files (React + Vite); runtime framework resolver, stories pattern, preview parameters, and import of shared global CSS.
Tooling, scripts & infra
package.json (root .gitignore), packages/propel/package.json, turbo.json, packages/propel/.eslintrc.js
Adds .gitignore entry storybook-static; adds storybook and build-storybook scripts in propel package; adds build-storybook turbo task with outputs; enables plugin:storybook/recommended in propel ESLint; adds Storybook dev dependencies.
Utilities
packages/propel/src/utils/classname.tsx, packages/propel/src/utils/index.ts
New cn(...inputs: ClassValue[]) wrapper around clsx and a utils barrel re-export.
Global styling / design tokens
packages/tailwind-config/global.css
Adds a comprehensive global Tailwind CSS file with theme tokens (light/dark variants), UI utilities, scrollbar rules, animations, and global resets.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Developer
  participant NPM as NPM Scripts
  participant SB as Storybook (React+Vite)
  participant Turbo as Turbo
  participant FS as Filesystem

  Dev->>NPM: npm run storybook
  NPM->>SB: start Storybook dev server (port 6006)
  SB-->>Dev: serves stories from ../src/**/*.stories.@(ts|tsx)
  Note right of SB: loads global CSS from @plane/tailwind-config/global.css

  Dev->>NPM: npm run build-storybook
  NPM->>SB: build static site
  SB->>FS: write output to storybook-static/**
  Turbo->>SB: build-storybook dependsOn ^build (orchestrates)
  FS-->>Dev: storybook-static available
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

🌐frontend, requires approval

Suggested reviewers

  • sriramveeraghanta
  • vamsikrishnamathala

Poem

A rabbit paints the Storybook light,
Tailwind tokens glow through night.
cn ties classes, tidy and neat,
Static burrows ready to greet.
Hop—dev server hums, stories take flight. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore-propel-storybook-setup

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
🪧 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@makeplane
Copy link

makeplane bot commented Aug 21, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

Copy link
Contributor

@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: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/tailwind-config/tailwind.config.js (1)

1-3: convertToRGB returns rgba(...) without alpha — invalid CSS; use rgb(var(...)) instead.

Today, rgba() requires an alpha component; rgba(23,23,23) is invalid. We should output rgb(var(--token)) for 3‑component variables and use rgba(var(--token), <alpha>) only when we need opacity.

Apply this change at the top helpers:

-const convertToRGB = (variableName) => `rgba(var(${variableName}))`;
+const convertToRGB = (variableName) => `rgb(var(${variableName}))`;
 const convertToRGBA = (variableName, alpha) =>
   `rgba(var(${variableName}), ${alpha})`;

Note: This aligns with how tokens are defined in global.css (triplets for rgb and occasional quartets where alpha is intended). After this change, scan for any call sites that relied on the previous (invalid) rgba behavior.

🧹 Nitpick comments (10)
packages/tailwind-config/tailwind.config.js (1)

21-21: Likely wrong content glob due to content.relative=true; remove or correct "./propel/".**

With content.relative: true, globs are resolved relative to this config file’s directory (packages/tailwind-config). "./propel/**/*" would point to packages/tailwind-config/propel/**, which likely doesn’t exist. You already include the correct workspace path at Line 23 ("../../packages/propel/src/**/*.{js,ts,jsx,tsx}"). Suggest removing the redundant/incorrect glob and (optionally) excluding Propel stories to avoid shipping story-only classes.

Apply this diff:

@@
-      "./propel/**/*.{js,ts,jsx,tsx}",
       "../../packages/ui/src/**/*.{js,ts,jsx,tsx}",
       "../../packages/propel/src/**/*.{js,ts,jsx,tsx}",
       "../../packages/editor/src/**/*.{js,ts,jsx,tsx}",
-      "!../../packages/ui/**/*.stories{js,ts,jsx,tsx}",
+      "!../../packages/ui/**/*.stories{js,ts,jsx,tsx}",
+      "!../../packages/propel/**/*.stories{js,ts,jsx,tsx}",
packages/propel/package.json (2)

12-14: LGTM: Storybook scripts are correct for v9 CLI.

storybook dev -p 6006 and storybook build are the right commands. Consider adding a "preview-storybook" script if you routinely serve the static build, but not required.


34-41: Dependencies for cn utility look good; double-check intended public surface.

Adding clsx and tailwind-merge makes sense for the cn utility. If cn is meant to be consumed externally, consider adding an explicit export path (e.g., "./utils": "./src/utils/index.ts") so consumers don’t import internal paths. If it’s internal-only, ignore.

packages/tailwind-config/global.css (2)

382-421: Move demo/feature-specific styles (tags input) out of global design tokens.

These are component/demo-specific rules and bloat global CSS for all consumers. Consider relocating to Storybook-only CSS or the component package’s scoped stylesheet.

I can open a follow-up PR moving these into a Storybook preview CSS file if helpful.


475-592: Spinner block is sizable and opinionated; consider localizing it.

Same rationale as tags input. Unless used across apps, prefer colocating this in the specific feature (or Storybook) to keep global CSS lean.

packages/propel/src/utils/index.ts (1)

1-1: Prefer explicit named/type re-exports over export * for stability

Barrel looks fine, but explicit exports reduce accidental surface area and ease tree-shaking. Also handy to re-export ClassValue so consumers can type their helpers.

Apply:

-export * from "./classname";
+export { cn } from "./classname";
+export type { ClassValue } from "clsx";
packages/propel/src/utils/classname.tsx (1)

1-4: Add explicit return type and consider .ts extension (no JSX)

Implementation is standard (clsx + tailwind-merge) and correct. Two small polish items:

  • Type the return explicitly to improve API clarity in IDEs.
  • Since there’s no JSX, rename to .ts to avoid unnecessary .tsx tooling paths.

Suggested tweak:

-import { clsx, type ClassValue } from "clsx";
+import { clsx, type ClassValue } from "clsx";
 import { twMerge } from "tailwind-merge";

-export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
+export const cn = (...inputs: ClassValue[]): string => twMerge(clsx(inputs));

If you want, I can add a tiny test matrix for cn (strings, arrays, conditionals, duplicates merging).

packages/propel/.storybook/preview.ts (1)

1-3: Import Preview type from @storybook/react for framework-agnostic typing

Depending on the Storybook version, types are exposed from @storybook/react (commonly recommended), while the framework runner stays @storybook/react-vite. This avoids future churn if you switch renderers.

-import type { Preview } from "@storybook/react-vite";
+import type { Preview } from "@storybook/react";
 import "@plane/tailwind-config/global.css";

Please confirm the project’s SB major version; I can adjust this if you’re pinned to a variant that exports the type from react-vite.

packages/propel/.storybook/main.ts (2)

9-11: Avoid any and make require.resolve ESM-safe

  • getAbsolutePath’s return type can be string.
  • In ESM Storybook environments, require might be undefined. Use createRequire to keep Yarn PnP/monorepo resolution robust.
-import { join, dirname } from "path";
+import { join, dirname } from "node:path";
+import { createRequire } from "node:module";
@@
-function getAbsolutePath(value: string): any {
-  return dirname(require.resolve(join(value, "package.json")));
-}
+function getAbsolutePath(value: string): string {
+  const r = typeof require === "undefined" ? createRequire(import.meta.url) : require;
+  return dirname(r.resolve(join(value, "package.json")));
+}

If your TS/build setup guarantees CJS here, the ESM guard is harmless; if not, it prevents runtime failures.


13-19: Add @storybook/addon-essentials so configured Controls actually show up

preview.ts configures parameters.controls.matchers, but no addons are enabled. Without Essentials, Controls (and other commonly expected features) won’t render.

 const config: StorybookConfig = {
   stories: ["../src/**/*.stories.@(ts|tsx)"],
-  addons: [],
+  addons: [getAbsolutePath("@storybook/addon-essentials")],
   framework: {
     name: getAbsolutePath("@storybook/react-vite"),
     options: {},
   },
 };

If you prefer a slimmer set, we can include only @storybook/addon-controls and friends explicitly—say the word.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 03479cf and fb385ea.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .gitignore (1 hunks)
  • packages/propel/.eslintrc.js (1 hunks)
  • packages/propel/.storybook/main.ts (1 hunks)
  • packages/propel/.storybook/preview.ts (1 hunks)
  • packages/propel/package.json (2 hunks)
  • packages/propel/src/utils/classname.tsx (1 hunks)
  • packages/propel/src/utils/index.ts (1 hunks)
  • packages/tailwind-config/global.css (1 hunks)
  • packages/tailwind-config/tailwind.config.js (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-04T16:22:44.344Z
Learnt from: lifeiscontent
PR: makeplane/plane#7164
File: packages/ui/.storybook/main.ts:24-47
Timestamp: 2025-06-04T16:22:44.344Z
Learning: In packages/ui/.storybook/main.ts, the webpackFinal function intentionally overrides the CSS loader strategy by finding and replacing existing CSS rules. This is a temporary workaround for a known upstream issue in Storybook's CSS handling that has been communicated to the Storybook maintainers. The current implementation should not be changed until the upstream issue is resolved.

Applied to files:

  • packages/propel/.storybook/main.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (python)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (4)
.gitignore (1)

100-101: LGTM: ignore storybook-static (matches anywhere in the repo).

The plain pattern "storybook-static" will ignore any directory with that name at any depth (e.g., packages/propel/storybook-static), which is exactly what we want for Storybook builds.

packages/propel/.eslintrc.js (1)

4-4: LGTM: Enable Storybook ESLint rules.

Extending plugin:storybook/recommended is consistent with the new Storybook setup and the devDependency has been added. No further changes needed.

packages/propel/package.json (1)

46-51: Version alignment: Storybook 9 packages are consistent; ensure repo-wide tooling matches.

storybook, @storybook/react-vite, and eslint-plugin-storybook are all on 9.1.x—good. Verify that any shared scripts/tooling (root package, CI) aren’t pinning Storybook 8.x, and that Vite plugins in the workspace are compatible.

packages/propel/.storybook/main.ts (1)

1-19: Good: Vite framework, minimal config, Yarn PnP-friendly resolver

This mirrors Storybook’s recommended v8 monorepo pattern and avoids the webpack CSS loader overrides that we keep in packages/ui per prior learnings. No action needed here.

Copy link
Collaborator

@lifeiscontent lifeiscontent left a comment

Choose a reason for hiding this comment

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

a good start, but needs work ✨

Copy link
Contributor

@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

🧹 Nitpick comments (2)
turbo.json (2)

41-44: Exclude storybook-static from lint inputs to avoid scanning generated artifacts

Linting over compiled Storybook output can slow CI and produce noisy results. You already exclude .next and dist—extend that to storybook-static.

     "check:lint": {
       "cache": false,
-      "inputs": ["**/*", "!**/.next/**", "!**/dist/**"]
+      "inputs": ["**/*", "!**/.next/**", "!**/dist/**", "!**/storybook-static/**"]
     },

28-31: Optional: define inputs for build-storybook for tighter cache keys

Turbo will infer inputs, but being explicit can make cache behavior clearer and exclude bulky, irrelevant dirs.

-    "build-storybook": {
-      "dependsOn": ["^build"],
-      "outputs": ["storybook-static/**"]
-    },
+    "build-storybook": {
+      "dependsOn": ["build", "^build"],
+      "inputs": ["**/*", "!**/.next/**", "!**/dist/**", "!**/storybook-static/**", "!**/coverage/**"],
+      "outputs": ["storybook-static/**"]
+    },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between fb385ea and 77aee58.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • packages/propel/.storybook/main.ts (1 hunks)
  • packages/propel/.storybook/preview.ts (1 hunks)
  • packages/propel/package.json (3 hunks)
  • packages/tailwind-config/tailwind.config.js (1 hunks)
  • turbo.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/propel/.storybook/main.ts
  • packages/propel/.storybook/preview.ts
  • packages/tailwind-config/tailwind.config.js
  • packages/propel/package.json
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build and lint web apps
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
turbo.json (2)

28-31: LGTM: Task name and outputs align with Storybook defaults

The pipeline task name matches the package script and the outputs pattern correctly captures the Storybook static build directory. This will enable deterministic Turbo caching and pairs well with the repo’s .gitignore update.


28-31: No local build dependency needed for Propel’s Storybook

After inspecting packages/propel/.storybook and the package’s entry points, we can confirm:

  • The Storybook config (main.ts) directly loads stories from the local src tree ("../src/**/*.stories.@(ts|tsx)") and resolves components via Vite at runtime.
  • There are no imports from dist or from @plane/propel in any stories or preview files.
  • The package.json exports point to source files, not to built artifacts.

Because Storybook is bundling the source files in src directly and does not consume the compiled outputs, adding "build" to the dependsOn array will not affect the Storybook build. The existing ^build dependency already ensures upstream packages are built before Storybook runs.

You can safely ignore the suggested change to "dependsOn": ["build", "^build"].

Copy link
Collaborator

@lifeiscontent lifeiscontent left a comment

Choose a reason for hiding this comment

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

we should definitely try to clean more of this up soon.

@sriramveeraghanta sriramveeraghanta merged commit c246493 into preview Aug 25, 2025
7 of 8 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore-propel-storybook-setup branch August 25, 2025 20:44
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.

3 participants