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

Chore/tag migration #73

Open
wants to merge 17 commits into
base: chore/tailwind-migration
Choose a base branch
from

Conversation

Harman-singh-waraich
Copy link
Contributor

@Harman-singh-waraich Harman-singh-waraich commented Mar 18, 2025

  • Displays
    • Icon, Large, Small
  • Containers
    • Card, Box, Modal
  • Tag

Summary by CodeRabbit

  • New Features

    • Added an enhanced theme toggle for a more dynamic visual experience.
    • Introduced updated interactive demos that showcase components in various states.
  • Refactor & Style

    • Updated UI components to use a more consistent, utility-first styling approach that enhances accessibility and visual consistency.
  • Chores

    • Streamlined build and code-quality processes by updating tooling and configurations for faster and more reliable development.

PR-Codex overview

This PR focuses on refactoring and updating various components in the codebase, enhancing the design and functionality of form elements, displays, and messages while removing deprecated components.

Detailed summary

  • Removed src/lib/form/field.tsx, radio.tsx, textarea.tsx
  • Introduced tailwindcss-react-aria-components dependency
  • Updated styles in src/lib/dot.tsx, ButtonIcon.tsx, accordion-item.tsx, etc.
  • Refactored Box, Modal, Card, DisplayLarge, DisplaySmall for improved structure
  • Added TextField, NumberField, TextArea components
  • Implemented RadioGroup for better radio button management
  • Enhanced Alert, Push, Copiable, Tooltip components with updated designs
  • Updated Storybook stories for new and modified components

The following files were skipped due to too many changes: src/lib/form/number-field.tsx, src/lib/tooltip/index.tsx

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (5)
  • master
  • main
  • dev
  • fix/*
  • feat/*

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

This pull request removes outdated configuration files and replaces them with new configuration files for ESLint, Parcel, PostCSS, Prettier, Vite, and Storybook. Many UI components and hooks have been refactored to transition from styled-components to utility-first CSS using Tailwind CSS. Several component properties were renamed for consistency (e.g., replacing “disabled” with “isDisabled”), and event handlers have been updated (from onClick to onPress). New Storybook stories and configuration files have been added to document components, and utility functions and type definitions have been introduced or updated in various parts of the project.

Changes

Files / Groups Change Summary
.eslintrc.json, .parcelrc Removed configuration files for ESLint and Parcel bundler (removes ESLint settings and SVG transformer for React).
.postcssrc, .prettierrc, eslint.config.mjs New configuration files added for PostCSS (with Tailwind integration), Prettier (with Tailwind plugin), and a flat ESLint config supporting React/TS.
.gitignore Updated to ignore *storybook.log files.
package.json, tsconfig.json, vite.config.ts Updated project build system from Parcel to Vite, modified scripts, dependency versions, and adjusted TypeScript excludes and options; new Vite config file added.
.storybook/main.ts, .storybook/preview.tsx
and multiple story files (src/stories/*.tsx / .mdx)
Introduced new Storybook configuration files and a suite of stories for Accordion, Box, Breadcrumb, Button, Card, Display components, Modal, Tag, etc.
UI Components (e.g., src/App.tsx, src/examples/*, src/lib/*) Refactored components by removing styled-components in favor of utility classes; updated event handlers (onClick → onPress); renamed props (disabled → isDisabled); added new state and methods (e.g., theme toggling in App).
Hooks & Utilities (src/hooks/*, src/utils/index.ts) Minor syntactical improvements (trailing commas, updated ESLint comments) and addition of a new utility function (cn) for merging Tailwind class names.
Styles (src/styles/global.css, src/styles/common-style.ts) Added a new global CSS file with Tailwind imports and custom properties for themes; minor formatting updates in common-style file.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant App as App Component
    participant D as Document Root

    U->>App: Click "Toggle Theme" Button
    App->>App: Execute changeTheme() to switch tailwindTheme
    App->>D: Update document.documentElement class (light/dark)
    D-->>App: Acknowledge theme update
Loading

Possibly related PRs

  • chore: button-migration #69: Refactors button implementations by removing styled-components and replacing them with utility-based components, similar to the changes in this PR.

Suggested reviewers

  • alcercu

Poem

I'm a rabbit hopping through the code,
Leaving styled trails in a lighter mode,
Toggling themes with a nimble leap,
Utility classes now fast and deep,
With each press the button sings—
A joyful dance in digital springs!
🐰🌟


🪧 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 or @coderabbitai title 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.

@Harman-singh-waraich Harman-singh-waraich changed the base branch from main to chore/tailwind-migration March 18, 2025 09:37
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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 7

🔭 Outside diff range comments (2)
src/stories/displaySmall.stories.tsx (1)

1-28: ⚠️ Potential issue

Fix naming inconsistencies in display component story

There are several naming inconsistencies in this file that need to be addressed:

  1. The file is named displaySmall.stories.tsx but imports SmallDisplayComponent from "../lib/display/large"
  2. The story export is named DisplayLarge (line 18) while the story title is "Display/DisplaySmall" (line 10)
  3. There appears to be another story with the same export name DisplayLarge in a different file

To resolve these inconsistencies:

  1. Verify the correct component path and update either the import or file name
  2. Make the export name consistent with the story title, likely changing:
-export const DisplayLarge: Story = {
+export const DisplaySmall: Story = {
  1. Ensure this story is demonstrating the small display variant if that's what the filename suggests
src/lib/form/file-uploader.tsx (1)

94-94: 🛠️ Refactor suggestion

Unaddressed TODO for proper typing

Line 94 contains a TODO comment regarding the typing of fileInputRef. This should be addressed as part of the migration work.

-  const fileInputRef = useRef<any>(); //! type
+  const fileInputRef = useRef<HTMLInputElement>(null);
🧹 Nitpick comments (26)
src/stories/utils.tsx (1)

1-6: Consider aligning IPreviewArgs type structure with .storybook/preview.tsx

The new IPreviewArgs type structure differs from the one in .storybook/preview.tsx. The one here nests themeUI and backgroundUI under an args property, while the one in preview.tsx has these properties directly on the type.

// Current implementation in utils.tsx
export type IPreviewArgs = {
  args: {
    themeUI: "light" | "dark";
    backgroundUI: "white" | "light";
  };
};

// From .storybook/preview.tsx
export type IPreviewArgs = {
  themeUI: "light" | "dark";
  backgroundUI: "white" | "light";
};

Consider either aligning these type definitions for consistency or documenting why they have different structures if there's a specific reason.

src/hooks/use-focus-outside.tsx (1)

4-5: ESLint directive updated, but type safety could be improved.

The ESLint rule update is appropriate, but the hook uses non-specific types (any and Function) which bypass TypeScript's type safety features.

Consider improving type safety with more specific types:

- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
- function useFocusOutside(ref: any, callback: Function) {
-   useEffect(() => {
-     function handleEvent(event: any) {
+ function useFocusOutside(
+   ref: React.RefObject<HTMLElement>,
+   callback: () => void
+ ) {
+   useEffect(() => {
+     function handleEvent(event: MouseEvent | FocusEvent) {
🧰 Tools
🪛 Biome (1.9.4)

[error] 5-5: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

vite.config.ts (1)

1-22: Vite configuration looks good, with a minor concern.

The Vite configuration is properly set up for building a React component library with the necessary plugins. This is a good migration from Parcel.

The ESLint disable comment for the tailwindcss import suggests a potential resolution issue. Consider investigating why this import can't be resolved properly - it might indicate a missing type declaration or package.json configuration issue.

src/lib/messages/push.tsx (1)

75-76: Replace generic Function type with specific function signature

While the ESLint rule has been updated to the more specific @typescript-eslint/no-unsafe-function-type, the code still uses the generic Function type. This is generally discouraged for type safety reasons.

Since the callback is used without parameters at line 100, consider using a more specific type:

-  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
-  callback: Function;
+  callback: () => void;

This will provide better type safety and IDE assistance without requiring the ESLint disable comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 76-76: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/lib/dropdown/button.tsx (1)

46-47: Use specific function signature instead of generic Function type

While the ESLint rule has been updated, the code still uses the generic Function type which doesn't provide proper type safety.

Since setIsOpen is used with a boolean parameter at line 56, consider using a more specific type signature:

-  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
-  setIsOpen: Function;
+  setIsOpen: (isOpen: boolean) => void;

This will provide better type checking and IDE support without requiring an ESLint disable comment.

🧰 Tools
🪛 Biome (1.9.4)

[error] 47-47: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/lib/pagination/tabs.tsx (1)

76-77: Consider using a specific function type rather than Function

The ESLint rule is being updated from disabling @typescript-eslint/ban-types to @typescript-eslint/no-unsafe-function-type, which suggests awareness of the typing issue. However, using the generic Function type is still not type-safe.

Consider replacing it with a more specific function signature that accurately represents the callback's parameters and return type:

-  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
-  callback: Function;
+  callback: (value: any) => void;

This would improve type safety while still accommodating the current usage pattern in the component.

🧰 Tools
🪛 Biome (1.9.4)

[error] 77-77: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/lib/button/ButtonIcon.tsx (1)

1-25: Consider handling the case when both Icon and icon are undefined.

The ButtonIcon component is well-structured and properly handles conditional rendering based on the button variant and state. However, there's no fallback when both icon and Icon are null/undefined, which could result in rendering nothing.

const ButtonIcon: React.FC<
  Pick<ButtonProps, "Icon" | "icon" | "isDisabled" | "isLoading" | "variant">
> = ({ Icon, icon, isDisabled, isLoading, variant }) => {
  const isSecondary = variant === "secondary";
  return (
-    icon ??
-    (Icon && (
+    icon ?? (Icon ? (
      <Icon
        className={cn(
          "button-svg",
          "mr-2 h-4 w-4",
          "fill-klerosUIComponentsWhiteBackground",
          isLoading && ["invisible"],
          isSecondary && ["fill-klerosUIComponentsPrimaryBlue"],
          isDisabled && ["fill-klerosUIComponentsStroke"],
        )}
      />
-    ))
+    )) : null)
  );
};
src/stories/accordion.stories.tsx (1)

18-42: Story structure is good, but consider diversifying demo content.

The Accordion story setup is well-structured with proper theme configuration. However, for better demonstration value:

  1. Both accordion items have identical titles ("How it works?")
  2. The first item contains repetitive content with multiple newlines that may not demonstrate the component's capabilities effectively
export const DarkTheme: Story = {
  args: {
    className: "max-w-[80dvw]",

    items: [
      {
-        title: "How it works?",
+        title: "How does it work?",
        body: (
          <small className="text-klerosUIComponentsPrimaryText">
-            {"hello\nhello\n\n\n\n\nhello"}
+            {"The accordion component allows users to expand and collapse content sections as needed.\nThis helps manage screen space effectively."}
          </small>
        ),
      },
      {
-        title: "How it works?",
+        title: "When should I use it?",
        body: (
-          <small className="text-klerosUIComponentsPrimaryText">hello</small>
+          <small className="text-klerosUIComponentsPrimaryText">Use accordions when you need to organize related information in a compact format that can be expanded when needed.</small>
        ),
      },
    ],

    themeUI: "dark",
    backgroundUI: "light",
  },
};
src/lib/container/box.tsx (1)

4-16: Consider making dimensions configurable instead of hardcoded.

The Box component has been effectively refactored to use utility classes instead of styled-components. However, the hardcoded dimensions (h-[200px] w-[328px]) reduce its flexibility when used in different contexts. Consider making these dimensions adjustable through props.

-function Box({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {
+function Box({ 
+  className, 
+  width = "328px",
+  height = "200px",
+  ...props 
+}: React.HTMLAttributes<HTMLDivElement> & {
+  width?: string;
+  height?: string;
+}) {
  return (
    <div
      className={cn(
-        "bg-klerosUIComponentsMediumBlue h-[200px] w-[328px]",
+        "bg-klerosUIComponentsMediumBlue",
+        { [`h-[${height}]`]: height },
+        { [`w-[${width}]`]: width },
        "box-border rounded-[18px]",
        className,
      )}
    >
      {props.children}
    </div>
  );
}

Note: The current implementation works well if you're always overriding the dimensions with className. If that's the intended usage pattern, this refactor might not be necessary.

src/lib/dropdown/simple-button.tsx (1)

69-70: Consider using a more specific function type signature

While updating the ESLint disable comment is appropriate, the underlying issue with using the generic Function type still exists. This doesn't provide type safety for parameters or return values.

- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
- setIsOpen: Function;
+ setIsOpen: (isOpen: boolean) => void;
🧰 Tools
🪛 Biome (1.9.4)

[error] 70-70: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/lib/accordion/index.tsx (1)

33-36: Fixed width could limit responsiveness

While the migration to utility classes is good, the hardcoded width of w-[1000px] may cause issues on smaller screens. Consider using a responsive width or making this configurable.

-      className={cn("box-border flex w-[1000px] flex-col", className)}
+      className={cn("box-border flex w-full max-w-[1000px] flex-col", className)}
src/lib/form/file-uploader.tsx (1)

80-81: Updated ESLint rule for better type safety

The ESLint comment was updated to use the more specific @typescript-eslint/no-unsafe-function-type rule. However, it would be better to define a more specific type than using the generic Function type.

-  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
-  callback: Function;
+  callback: (file: File) => void;
🧰 Tools
🪛 Biome (1.9.4)

[error] 81-81: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/lib/dropdown/base-item.tsx (1)

84-85: Consider updating event handler to match other components

For consistency with other components that have been migrated to react-aria-components (like the Button in App.tsx), consider updating this component to use onPress instead of onClick.

-  <Item
-    onKeyPress={(e) => (onClick && e.key === "Enter" ? onClick() : undefined)}
-    {...{ onClick, ...props }}
-  >
+  <Item
+    onPress={onClick}
+    {...props}
+  >
src/lib/dot.tsx (1)

1-15: Good migration from styled-components to Tailwind CSS

The refactoring successfully transitions the component from styled-components to a functional component using Tailwind CSS classes, maintaining the same visual appearance while allowing for extensibility through the className prop.

Consider adding type validation or default value for the color prop to prevent potential rendering issues with invalid colors.

-interface DotProps {
-  color: string;
-  className?: string;
-}
+interface DotProps {
+  color: string; // Consider using a ColorType or providing validation
+  className?: string;
+}
+
+function Dot({ color, className }: Readonly<DotProps>) {
src/lib/container/modal.tsx (1)

1-23: Improved Modal component with react-aria for better accessibility

Good migration from styled-components to react-aria-components with Tailwind CSS, which enhances accessibility while maintaining styling capabilities.

The hard-coded dimensions (h-[200px] w-[328px]) might limit the component's flexibility for different use cases. Consider making the dimensions customizable through props.

-function Modal({
-  className,
-  ...props
-}: ModalOverlayProps & React.RefAttributes<HTMLDivElement>) {
+interface ModalProps extends ModalOverlayProps, React.RefAttributes<HTMLDivElement> {
+  className?: string;
+  width?: string;
+  height?: string;
+}
+
+function Modal({
+  className,
+  width = "328px",
+  height = "200px",
+  ...props
+}: ModalProps) {
  return (
    <AriaModel
      className={cn(
-        "bg-klerosUIComponentsWhiteBackground h-[200px] w-[328px]",
+        "bg-klerosUIComponentsWhiteBackground",
+        `h-[${height}] w-[${width}]`,
        "rounded-base box-border",
        className,
      )}
    >
src/stories/button.stories.tsx (1)

29-75: Comprehensive set of Button variants and states

The stories provide excellent coverage of different button variants (primary, secondary, tertiary) and states (with icon, loading). Each example is configured with consistent theming.

To further enhance the documentation:

  • Consider adding brief descriptions for each story explaining the intended use case for each button variant
  • Add examples demonstrating other button states like hover, focus, or active
  • Clarify whether the loading state automatically disables the button or if that's a separate concern
src/stories/Configure.mdx (3)

18-32: Consider using Tailwind classes instead of inline styles for RightArrow

Since your project is migrating to Tailwind CSS, consider replacing the inline styles with Tailwind utility classes to maintain consistency with the rest of the codebase.

export const RightArrow = () => <svg 
    viewBox="0 0 14 14" 
    width="8px" 
    height="14px" 
-   style={{ 
-     marginLeft: '4px',
-     display: 'inline-block',
-     shapeRendering: 'inherit',
-     verticalAlign: 'middle',
-     fill: 'currentColor',
-     'path fill': 'currentColor'
-   }}
+   className="ml-1 inline-block align-middle fill-current"
>
  <path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
</svg>

200-200: Fix typo in sentence

There's a grammatical error in this sentence - the word "on" seems out of place.

-      <p>Follow guided walkthroughs on for key workflows.</p>
+      <p>Follow guided walkthroughs for key workflows.</p>

208-364: Consider extracting styles to a separate file

The CSS styling in this file is quite extensive. If these styles are shared across multiple Storybook documentation files, consider extracting them to a separate CSS file to improve maintainability.

src/lib/display/small.tsx (2)

4-6: Streamline utility imports

You're importing both cn and clsx utilities which serve similar purposes. Consider using only one for class name composition to maintain consistency.

import React from "react";
import Card from "../container/card";
import { DisplayIconProps } from "./icon";
import { cn } from "../../utils";
import { Label } from "react-aria-components";
-import clsx from "clsx";

Then update the Card component usage to use only cn:

-      <Card className={clsx("h-[45px] w-full", "mt-4 flex items-center px-4")}>
+      <Card className={cn("h-[45px] w-full mt-4 flex items-center px-4")}>

26-34: Consider making width more flexible

The fixed width and height constraints might limit component flexibility in different contexts. Consider making these dimensions responsive or accepting sizing props.

-      <Card className={clsx("h-[45px] w-full", "mt-4 flex items-center px-4")}>
+      <Card className={cn("h-[45px] w-full mt-4 flex items-center px-4", {
+        "w-full": true, // Default width
+        // Add other conditional classes here
+      })}>
src/lib/container/card.tsx (1)

9-24: Consider more flexible sizing options

The component has fixed dimensions (h-[200px] w-[328px]) which might limit its reusability. Consider adding size variants or making the dimensions more flexible.

function Card({ hover, round, className, ...props }: Readonly<CardProps>) {
  return (
    <div
      className={cn(
-       "bg-klerosUIComponentsWhiteBackground box-border h-[200px] w-[328px]",
+       "bg-klerosUIComponentsWhiteBackground box-border",
        "border-klerosUIComponentsStroke hover-short-transition shadow-default border",
        hover && "hover:bg-klerosUIComponentsLightGrey hover:cursor-pointer",
        round ? "rounded-[18px]" : "rounded-base",
        className,
      )}
      {...props}
    >
      {props.children}
    </div>
  );
}

This change allows the component to be sized through the className prop, making it more flexible in different contexts.

src/lib/display/icon.tsx (1)

3-5: Consolidate utility imports

You're importing both cn and clsx utilities which serve similar purposes. Consider using only one to maintain consistency throughout the codebase.

import React from "react";
import Card from "../container/card";
import { cn } from "../../utils";
-import clsx from "clsx";
import { Label } from "react-aria-components";

Then update all className usages to use only cn.

package.json (1)

15-23: Updated and new scripts
You have replaced Parcel with Vite and Storybook. Using rm -rf dist may cause cross-platform issues. Consider using a package like rimraf for cross-platform compatibility.

- "clean": "rm -rf dist",
+ "clean": "rimraf dist",
src/lib/breadcrumb.tsx (1)

8-9: Consider using a more specific type instead of Function

The Function type is overly permissive and flagged by static analysis tools. Even with the ESLint disable comment, it's better to use a more specific type definition.

-  // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
-  callback?: Function;
+  callback?: (value: any) => void;
🧰 Tools
🪛 Biome (1.9.4)

[error] 9-9: Don't use 'Function' as a type.

Prefer explicitly define the function shape. This type accepts any function-like value, which can be a common source of bugs.

(lint/complexity/noBannedTypes)

src/styles/global.css (1)

111-195: Comprehensive theme mapping and animations

The theme section:

  • Maps CSS variables to themed variable names for easier reference
  • Defines animations for fade-in and breathing effects
  • Sets up common transition durations and easing functions
  • Configures default shadow values

One suggestion: consider documenting the usage of these animations and transitions in a comment for other developers.

  /* Animations */
+ /* Usage: 
+  * animation: var(--animate-fade-in);
+  * animation: var(--animate-breathing);
+  */
  @keyframes fadeIn {
🛑 Comments failed to post (7)
eslint.config.mjs (1)

66-75: 💡 Verification agent

🧩 Analysis chain

React version might need an update

The settings correctly configure import resolution for various file extensions, but the React version specified is quite old (^16.12.0), which may not match the current project version.


🏁 Script executed:

#!/bin/bash
# Check the current React version in package.json
grep -A 5 '"react":' package.json || grep -A 5 "\"react\":" package.json

Length of output: 364


Action Required: Update ESLint React Version Setting

The ESLint configuration in eslint.config.mjs on lines 66–75 still specifies React version "^16.12.0", but the current package.json shows the project is using React version "^18.0.0". Please update the ESLint config to match the installed version to maintain consistency and avoid any potential mismatches.

  • File: eslint.config.mjs (lines 66–75)
  • Change needed: Update react.version from "^16.12.0" to "^18.0.0"
src/lib/form/slider/handle.tsx (1)

55-56: ⚠️ Potential issue

Remove empty JSX fragment and handle potential undefined value

The ESLint disable comment for non-null assertion has been removed, but the code still uses a non-null assertion with dragging!.toString() on line 56. This might now trigger ESLint warnings. The empty JSX fragment {} doesn't serve any purpose.

Consider properly handling the potentially undefined value:

-    {}
-    <StyledHandle dragging={dragging!.toString()} {...props} />
+    <StyledHandle dragging={(dragging ?? false).toString()} {...props} />
📝 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.

    <StyledHandle dragging={(dragging ?? false).toString()} {...props} />
src/stories/modal.stories.tsx (1)

5-5: ⚠️ Potential issue

Incorrect import path for ModalComponent

The Modal story is importing ModalComponent from "../lib/container/box" which appears to be incorrect. A Modal component should be imported from a modal-related file, not a box component.

-import ModalComponent from "../lib/container/box";
+import ModalComponent from "../lib/container/modal"; // or the correct path to modal

Verify the correct import path for the Modal component to ensure the story is displaying the intended component.

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

import ModalComponent from "../lib/container/modal"; // or the correct path to modal
src/stories/displayLarge.stories.tsx (1)

1-27: 💡 Verification agent

🧩 Analysis chain

Storybook setup looks good but verify display component naming consistency.

This Storybook story file for the LargeDisplayComponent is well-structured with appropriate imports, metadata configuration, and story definition. The component is properly configured with theme, background, sizing, and content properties.

I noticed that in another file (displaySmall.stories.tsx), there's also a story named DisplayLarge with different property values. Consider verifying that the story naming is consistent across files to avoid confusion.


🏁 Script executed:

#!/bin/bash
# Check for potential display component naming inconsistencies
grep -r "export const DisplayLarge" --include="*.stories.tsx" src/

Length of output: 216


Naming Inconsistency in Story Exports Detected

The story export name "DisplayLarge" appears in both src/stories/displayLarge.stories.tsx and src/stories/displaySmall.stories.tsx, which can lead to confusion. Please verify whether the export in displaySmall.stories.tsx should be renamed (e.g., to "DisplaySmall") to reflect the intended component accurately.

  • Files to review:
    • src/stories/displayLarge.stories.tsx
    • src/stories/displaySmall.stories.tsx
src/lib/form/file-uploader.tsx (1)

132-133: 🛠️ Refactor suggestion

Removed ESLint directive for non-null assertion

The ESLint directive for the non-null assertion was removed, which is good for code quality. However, it would be better to handle the null case explicitly to prevent potential runtime errors.

-          setFileSelected(event.target.files![0]);
+          if (event.target.files && event.target.files.length > 0) {
+            setFileSelected(event.target.files[0]);
+          }
📝 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.

          if (event.target.files && event.target.files.length > 0) {
            setFileSelected(event.target.files[0]);
          }
src/stories/Configure.mdx (1)

29-29: ⚠️ Potential issue

Fix invalid CSS property

The property 'path fill' is not a valid CSS property. The fill property is already applied to the SVG itself, so this line can be removed.

    style={{ 
      marginLeft: '4px',
      display: 'inline-block',
      shapeRendering: 'inherit',
      verticalAlign: 'middle',
      fill: 'currentColor',
-     'path fill': 'currentColor'
    }}
📝 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.

    style={{ 
      marginLeft: '4px',
      display: 'inline-block',
      shapeRendering: 'inherit',
      verticalAlign: 'middle',
      fill: 'currentColor'
    }}
src/lib/display/icon.tsx (1)

24-24: ⚠️ Potential issue

Fix typo in className

There's a typo in the class name max--8 which should be max-h-8.

-        <Icon className="max--8 max-w-8" />
+        <Icon className="max-h-8 max-w-8" />
📝 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.

        <Icon className="max-h-8 max-w-8" />

Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5.5% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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