8000 Add theming property to define max checkbox size by lukasmasuch · Pull Request #1061 · glideapps/glide-data-grid · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add theming property to define max checkbox size #1061

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 3 commits into from
Jun 26, 2025

Conversation

lukasmasuch
Copy link
Collaborator
@lukasmasuch lukasmasuch commented Jun 26, 2025

Add an optional checkboxMaxSize that allows for the configuration of the max size (height & width) of checkboxes. This is applied to all checkboxes, e.g, boolean cell & row markers.

@lukasmasuch lukasmasuch requested a review from Copilot June 26, 2025 18:07
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds support for a new checkboxMaxSize theme setting so consumers can control the maximum dimensions of all checkboxes in the grid. Key changes include:

  • Propagate theme.checkboxMaxSize into the drawing routines and default parameters.
  • Extend the Theme interface, CSS variables, API docs, and storybook examples to expose the new property.
  • Update mock utilities and render calls to use the configurable size.

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
draw-checkbox.ts Use theme.checkboxMaxSize fallback in drawCheckbox
data-grid-render.header.ts Pass theme.checkboxMaxSize into header checkbox draws
theme-support.stories.tsx Add checkboxMaxSize to example dark and custom themes
08-theming.stories.tsx Document new checkboxMaxSize (and roundingRadius) in the table
utils.tsx (data-editor stories) Remove assertNever at end of lossyCopyData
styles.ts Inject --gdg-checkbox-max-size and add checkboxMaxSize to Theme
marker-cell.tsx Use theme.checkboxMaxSize for row marker sizing
boolean-cell.tsx Use theme.checkboxMaxSize for boolean cell sizing
API.md Add checkboxMaxSize (and roundingRadius) to the theme reference
Comments suppressed due to low confidence (3)

packages/core/src/data-editor/stories/utils.tsx:107

  • The removal of assertNever(target) at the end of lossyCopyData means the function may no longer enforce exhaustiveness and could implicitly return undefined. Reintroduce an assertion or explicit throw in the default case to ensure all EditableGridCell kinds are handled.
        }

packages/core/src/internal/data-grid/render/draw-checkbox.ts:24

  • We should add unit tests to verify the fallback logic for maxSize, especially when consuming theme.checkboxMaxSize versus the default value.
    let checkBoxWidth = getSquareWidth(maxSize ?? theme.checkboxMaxSize ?? 32, height, theme.cellVerticalPadding);

packages/core/src/common/styles.ts:52

  • Add a snapshot or style test to ensure the --gdg-checkbox-max-size CSS variable is correctly emitted when checkboxMaxSize is set or omitted.
        ...(theme.checkboxMaxSize === undefined ? {} : { "--gdg-checkbox-max-size": `${theme.checkboxMaxSize}px` }),

const rectBordRadius = style === "circle" ? 10_000 : theme.roundingRadius ?? 4;
let checkBoxWidth = getSquareWidth(maxSize, height, theme.cellVerticalPadding);
const rectBordRadius = style === "circle" ? 10_000 : (theme.roundingRadius ?? 4);
let checkBoxWidth = getSquareWidth(maxSize ?? theme.checkboxMaxSize ?? 32, height, theme.cellVerticalPadding);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the a reason why its 32 here instead of 18?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just because it was the default value for maxSize parameter in this specific function (see the function signature above). Not sure why it's 32, but to keep everything as is probably good to keep using it here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I would check drawCheckbox doesn't look visually different with a defined checkboxMaxSize value / try to figure out if we can just remove this magic 32 too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, sounds good. Changed it to have checkboxMaxSize always defined as 18 and removed 32. Did some manual checking, and everything looks good.

Copy link
Collaborator
@BrianHung BrianHung left a comment

Choose a reason for hiding this comment

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

Overall, LGTM. Turns magic number of 18 into a theme variable.

@lukasmasuch lukasmasuch merged commit 630e92a into main Jun 26, 2025
8 checks passed
@lukasmasuch lukasmasuch deleted the add-theming-prop-to-set-checkbox-size branch June 26, 2025 22:00
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
0