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(DataTable): add support for actions and different layouts #2953

Merged
merged 15 commits into from
Mar 1, 2023

Conversation

joshblack
Copy link
Member

@joshblack joshblack commented Feb 28, 2023

Closes https://github.com/github/primer/issues/1889

Add support for the different layouts for a DataTable (excluding filter). This adds a couple of stories that show support for the table with both a single action and multiple actions. It also includes support for a footer but this will be implemented by pagination

This PR adds two new components to accomplish this: Table.Divider and Table.Actions. It extends Table.Container to be a CSS Grid with different areas for the parts of the table.

Feedback

I would love to hear what you all think about this approach for the layout and if there are any other alternatives that I should explore here or that you suggest using!

If folks feel good with this, I'll make sure to add in some quick tests and docs examples for them 👍

Changelog

New

  • Add Table.Divider for rendering a divider in a table
  • Add Table.Actions for rendering a group of actions for a table
  • Add stories for the following situations:
    • With action
    • With action only (no title)
    • With actions
    • With actions only (no title)

Changed

  • Add support for sx prop to Table.Container
  • Table.Container is now a CSS Grid
  • Add .Table class name for Table component

Removed

@changeset-bot
Copy link

changeset-bot bot commented Feb 28, 2023

🦋 Changeset detected

Latest commit: 2ec85f0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 28, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 94.49 KB (0%)
dist/browser.umd.js 95.06 KB (0%)

@joshblack joshblack added the skip changeset This change does not need a changelog label Feb 28, 2023
@github-actions github-actions bot temporarily deployed to storybook-preview-2953 February 28, 2023 22:20 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2953 February 28, 2023 22:21 Inactive
@joshblack
Copy link
Member Author

Quick question for you @mperrotti, should the title of the table align to the top edge of the actions container? Or do we want them to be aligned vertically centered?

Top-aligned

Screenshot 2023-02-28 at 4 21 46 PM

Centered
Screenshot 2023-02-28 at 4 21 55 PM

@joshblack joshblack temporarily deployed to github-pages February 28, 2023 22:26 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-2953 February 28, 2023 22:27 Inactive
Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Your CSS is real nice ✨ love the use of grid areas! Stories look nice too

Copy link
Contributor

@colebemis colebemis left a comment

Choose a reason for hiding this comment

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

💖

@mperrotti
Copy link
Contributor

should the title of the table align to the top edge of the actions container? Or do we want them to be aligned vertically centered?

Vertically centered is good. I know PageHeader does top-aligned, but that's because they have a different set of layout problems where vertically-centered is more likely to create weird whitespace.

const StyledTableContainer = styled.div`
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-areas:
Copy link
Contributor

Choose a reason for hiding this comment

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

😍 great use of grid

Base automatically changed from feat/add-table-datatable-to-drafts to main March 1, 2023 21:47
@joshblack joshblack removed the skip changeset This change does not need a changelog label Mar 1, 2023
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.

4 participants