Skip to content

Use default color in Loader component for CSS variable #12844

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

Merged
merged 1 commit into from
Jun 24, 2025

Conversation

Devessier
Copy link
Contributor

Fixes a regression introduced by #11639

cc @AMoreaux

Before

CleanShot 2025-06-24 at 17 20 21@2x

After

CleanShot 2025-06-24 at 17 18 21@2x

CleanShot.2025-06-24.at.17.23.21.mp4

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

Adds proper fallback color handling for the Loader component to prevent invisible state when CSS variable --tw-button-color is undefined.

  • Modified packages/twenty-ui/src/feedback/loader/components/Loader.tsx to use theme.font.color.tertiary as fallback color when CSS variable is missing
  • Added comprehensive Storybook stories in packages/twenty-ui/src/feedback/loader/__stories__/Loader.stories.tsx to test color variations and default behavior
  • Improves component resilience by ensuring loader remains visible even without explicit color props
  • Stories include test assertions to verify visibility and styling correctness

2 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile

Comment on lines +36 to +38
// @ts-expect-error: Custom CSS variable for demonstration purposes
<div style={{ '--tw-button-color': 'blue' }}>
<Story />
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Custom CSS variable name should match existing naming convention. Consider using a more descriptive name like '--tw-loader-color' instead of '--tw-button-color' since this is for a loader component.

Suggested change
// @ts-expect-error: Custom CSS variable for demonstration purposes
<div style={{ '--tw-button-color': 'blue' }}>
<Story />
// @ts-expect-error: Custom CSS variable for demonstration purposes
<div style={{ '--tw-loader-color': 'blue' }}>
<Story />

Comment on lines +75 to +81
const loaders = await waitFor(() => {
const elements = canvasElement.querySelectorAll('#container > *');

expect(elements).toHaveLength(4);

return elements;
});
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Test could be more robust by checking if elements are not only present but also visible using .toBeVisible() for consistency with other stories.

Comment on lines 27 to +30
background-color: ${({ color, theme }) =>
color ? theme.tag.text[color] : `var(--tw-button-color)`};
color
? theme.tag.text[color]
: `var(--tw-button-color, ${theme.font.color.tertiary})`};
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Duplicate logic from StyledLoaderContainer. Consider extracting to a shared const or function

Copy link
Contributor

@AMoreaux AMoreaux left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@charlesBochet charlesBochet merged commit baaec81 into main Jun 24, 2025
36 checks passed
@charlesBochet charlesBochet deleted the loader-default-color branch June 24, 2025 15:29
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