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

feat(Table) add size option on cells #256

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cybervinvin
Copy link
Contributor

Summary

[explo] The goal for this PR is to add an option (size) to define the width of columns.

(Internal for Opendatasoft only) Associated Shortcut ticket: sc-48043.

Changes

New size option for cell with predefined values (small, medium, large and fit-content [default])

Breaking Changes

none

Changelog

In the Table component: It's now possible to define a size for the column width

Open discussion

explo ... all comments are welcome

To be tested

in storybook

Review checklist

  • Description is complete
  • Commits respect the Conventional Commits Specification
  • 2 reviewers (1 if trivial)
  • Tests coverage has improved
  • Code is ready for a release on NPM

@cybervinvin cybervinvin added the enhancement New feature or request label Jul 12, 2024
@cybervinvin cybervinvin force-pushed the feature/sc-48043/explo-sdk-table-width-options-for-a-column branch from 006e4e3 to 804455b Compare July 12, 2024 08:48
Copy link
Contributor

@etienneburdet etienneburdet left a comment

Choose a reason for hiding this comment

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

LGTM.

I wonderedl for a while if it was not CSS customization realm, but without this option it would hard to have to columns of the same type having different width.

We could argue that columns of the same type should have the same width though—in which case the type class is sufficient as a selector. But overall, I don't see any drawback to adding it, it's optional anyways if someone doesn't want to use it.

@cybervinvin cybervinvin marked this pull request as ready for review July 15, 2024 06:49
}
:global(.ods-dataviz--default td.table-data--long-text > span) {
:global(.ods-dataviz--default td.table-data--long-text > span),
:global(.ods-dataviz--default td.table-data--geo > div) {
Copy link
Contributor

Choose a reason for hiding this comment

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

image

Geo labels are no longer vertically centered

Are we sure we want to display geo labels on 3 lines?

Copy link
Contributor

@KevinFabre-ods KevinFabre-ods left a comment

Choose a reason for hiding this comment

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

With the changes made to the max-width properties, the short-text and long-text columns look identical in the display of their content. To see a difference, the optional size property needs to be applied.

I think we can improve this system.
Applying a maximum width to certain types of columns seems to be the right approach.

@@ -24,6 +24,7 @@ type BaseColumn = {
desc: string;
};
onClick?: () => void;
size?: 'large' | 'medium' | 'small' | 'fit-content';
Copy link
Contributor

Choose a reason for hiding this comment

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

If this option is not used at all for a table.
There is not difference between using a short-text and a long-text column.

image

Long texts no longer break on new line as there is no default max-width.

I agree with the comment made by @etienneburdet that default max-width should be set for some column types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants