Skip to content

Conversation

teczopio
Copy link

@teczopio teczopio commented Sep 4, 2025

…ariants

Pull Request

Description

Please provide a brief description of the changes introduced in this pull request.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Configuration change
  • ⚡ Performance improvement
  • ♻️ Code refactoring

Related Issues

Closes #<issue_number>

Branch Naming

  • My branch follows the naming convention (feat/, fix/, docs/, hotfix/, etc.)
  • I'm merging to the correct base branch (features → develop, hotfixes → main)

Checklist

  • My code follows the code style of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation, if necessary
  • I have added tests that prove my fix is effective or my feature works
  • New and existing tests pass locally with my changes
  • I have checked my code with pnpm lint and pnpm test
  • My commit messages follow the conventional commit format

Screenshots (if applicable)

Additional Notes

@teczopio teczopio requested review from uozopio and mkzopio September 4, 2025 11:19
@teczopio teczopio requested review from a team as code owners September 4, 2025 11:19
Copy link

github-actions bot commented Sep 4, 2025

🤖 Reviewers have been automatically assigned based on the CODEOWNERS file. If you need different reviewers, please update manually.

Copy link

github-actions bot commented Sep 4, 2025

✅ PR Size Check Passed

This PR changes 2988 lines across 6 files.

@teczopio
Copy link
Author

teczopio commented Sep 4, 2025

📄 Description

Added new Storybook and UI files (.stories.tsx) for the following components:

code-block
color-picker
combobox

🛠 Changes

Storybook files: Created under devapps/storybook/stories to provide visual documentation and testing for the new UI components.

return { h: h * 360, s: s * 100, l: l * 100 };
};

const hslToRgb = (h: number, s: number, l: number): { r: number; g: number; b: number } => {

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable hslToRgb.

Copilot Autofix

AI about 1 month ago

To resolve this warning, we should remove the unused function hslToRgb from the file. This involves deleting the block of code that defines hslToRgb, which begins at line 95 and ends at line 122. Since this function is not referenced elsewhere in the provided code, no further changes are required and no imports, methods, or definitions need to be updated to accommodate its removal.


Suggested changeset 1
packages/design-system/ui/color-picker.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/design-system/ui/color-picker.tsx b/packages/design-system/ui/color-picker.tsx
--- a/packages/design-system/ui/color-picker.tsx
+++ b/packages/design-system/ui/color-picker.tsx
@@ -92,35 +92,8 @@
   return { h: h * 360, s: s * 100, l: l * 100 };
 };
 
-const hslToRgb = (h: number, s: number, l: number): { r: number; g: number; b: number } => {
-  h /= 360;
-  s /= 100;
-  l /= 100;
 
-  const hue2rgb = (p: number, q: number, t: number): number => {
-    if (t < 0) t += 1;
-    if (t > 1) t -= 1;
-    if (t < 1/6) return p + (q - p) * 6 * t;
-    if (t < 1/2) return q;
-    if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
-    return p;
-  };
 
-  let r, g, b;
-
-  if (s === 0) {
-    r = g = b = l; // achromatic
-  } else {
-    const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
-    const p = 2 * l - q;
-    r = hue2rgb(p, q, h + 1/3);
-    g = hue2rgb(p, q, h);
-    b = hue2rgb(p, q, h - 1/3);
-  }
-
-  return { r: r * 255, g: g * 255, b: b * 255 };
-};
-
 const rgbToHsv = (r: number, g: number, b: number): { h: number; s: number; v: number } => {
   r /= 255;
   g /= 255;
EOF
@@ -92,35 +92,8 @@
return { h: h * 360, s: s * 100, l: l * 100 };
};

const hslToRgb = (h: number, s: number, l: number): { r: number; g: number; b: number } => {
h /= 360;
s /= 100;
l /= 100;

const hue2rgb = (p: number, q: number, t: number): number => {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1/6) return p + (q - p) * 6 * t;
if (t < 1/2) return q;
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
};

let r, g, b;

if (s === 0) {
r = g = b = l; // achromatic
} else {
const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
const p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}

return { r: r * 255, g: g * 255, b: b * 255 };
};

const rgbToHsv = (r: number, g: number, b: number): { h: number; s: number; v: number } => {
r /= 255;
g /= 255;
Copilot is powered by AI and may make mistakes. Always verify output.

const currentColor = value !== undefined ? value : internalValue;
const rgb = hexToRgb(currentColor);
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note

Unused variable hsl.

Copilot Autofix

AI about 1 month ago

The best way to fix the problem is to remove the declaration of the unused variable hsl from the code. This means deleting or commenting out the line that assigns a value to hsl (line 203). No further changes are necessary since no code relies on hsl in the provided snippet, so this can be safely done without affecting existing functionality.

You only need to edit the line:

  • In packages/design-system/ui/color-picker.tsx, remove the line:
    const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b); (line 203)

No additional definitions, imports, or code changes are required.


Suggested changeset 1
packages/design-system/ui/color-picker.tsx

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/packages/design-system/ui/color-picker.tsx b/packages/design-system/ui/color-picker.tsx
--- a/packages/design-system/ui/color-picker.tsx
+++ b/packages/design-system/ui/color-picker.tsx
@@ -200,7 +200,6 @@
 
     const currentColor = value !== undefined ? value : internalValue;
     const rgb = hexToRgb(currentColor);
-    const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
     const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);
 
     const [hue, setHue] = React.useState(hsv.h);
EOF
@@ -200,7 +200,6 @@

const currentColor = value !== undefined ? value : internalValue;
const rgb = hexToRgb(currentColor);
const hsl = rgbToHsl(rgb.r, rgb.g, rgb.b);
const hsv = rgbToHsv(rgb.r, rgb.g, rgb.b);

const [hue, setHue] = React.useState(hsv.h);
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant