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

fix(Table): Reconfigured the table CSS to better allow for content within a table to overlay the container, such as dropdowns. #1621

Merged
merged 19 commits into from
Jan 28, 2025

Conversation

chris-cedrone-cengage
Copy link
Collaborator

Issue: # 1556

What I did

  • Corrected CSS that was limiting dropdowns and other such UI elements that were being clipped within the Table container.

Screenshots:

noclip

Checklist

  • changeset has been added
  • Pull request description is descriptive
  • [N/A] I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • [N/A] I have added tests that prove my fix is effective or that my feature works

How to test

  • Head over to Storybook
  • Table example > With Dropdown
  • Click any of the dropdowns to verify they extend outside of the container appropriately

Copy link

changeset-bot bot commented Jan 17, 2025

🦋 Changeset detected

Latest commit: 201ddf5

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

This PR includes changesets to release 1 package
Name Type
react-magma-dom Patch

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

@silvalaura silvalaura linked an issue Jan 17, 2025 that may be closed by this pull request
Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

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

  1. hasSquareCorners is broken in this example: https://storybook-preview-1621--upbeat-sinoussi-f675aa.netlify.app/?path=/story/table--square-corners&args=hasSquareCorners:false
  2. This breaks the square corners if the dropdown item is in the last row:
    image
<Table maxWidth={500} {...args}>
        <TableHead>
          <TableRow>
            <TableHeaderCell>Column</TableHeaderCell>
            <TableHeaderCell>Column</TableHeaderCell>
            <TableHeaderCell>Column</TableHeaderCell>
            <TableHeaderCell>Column</TableHeaderCell>
          </TableRow>
        </TableHead>
        <TableBody>
          <TableRow>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>
              <Dropdown isInverse={args.isInverse}>
                <DropdownButton>Basic Dropdown</DropdownButton>
                <DropdownContent>
                  <DropdownMenuItem>Menu item 1</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                </DropdownContent>
              </Dropdown>
            </TableCell>
          </TableRow>
          <TableRow>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>
              <Select
                labelText="Select Example"
                items={[
                  { label: 'Red', value: 'red' },
                  { label: 'Blue', value: 'blue' },
                  { label: 'Green', value: 'green' },
                  { label: 'Yellow', value: 'yellow' },
                ]}
                isInverse={args.isInverse}
              />
            </TableCell>
          </TableRow>
          <TableRow>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell>
              <Combobox
                isMulti
                labelText="ComboBox Example"
                defaultItems={[
                  { label: 'Pink', value: 'pink' },
                  { label: 'Orange', value: 'orange' },
                  { label: 'Purple', value: 'purple' },
                ]}
                isInverse={args.isInverse}
              />
            </TableCell>
          </TableRow> <TableRow>
            <TableCell><Dropdown isInverse={args.isInverse}>
                <DropdownButton>Basic Dropdown</DropdownButton>
                <DropdownContent>
                  <DropdownMenuItem>Menu item 1</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                  <DropdownMenuItem>Menu item number two</DropdownMenuItem>
                </DropdownContent>
              </Dropdown></TableCell>
            <TableCell>Lorem ipsum dolor sit amet consectetur</TableCell>
            <TableCell><Select
                labelText="Select Example"
                items={[
                  { label: 'Red', value: 'red' },
                  { label: 'Blue', value: 'blue' },
                  { label: 'Green', value: 'green' },
                  { label: 'Yellow', value: 'yellow' },
                ]}
                isInverse={args.isInverse}
              /></TableCell>
            <TableCell>
              <Combobox
                isMulti
                labelText="ComboBox Example"
                defaultItems={[
                  { label: 'Pink', value: 'pink' },
                  { label: 'Orange', value: 'orange' },
                  { label: 'Purple', value: 'purple' },
                ]}
                isInverse={args.isInverse}
              />
            </TableCell>
          </TableRow>
        </TableBody>
      </Table>

Comment on lines 118 to 121
border-radius: ${props => (props.hasSquareCorners ? '0' : '0 0 0 8px')};
}
td:last-child {
border-radius: ${props => (props.hasSquareCorners ? '0' : '0 0 8px 0')};
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use our border radius variable

Comment on lines 88 to 93
&:first-child {
border-radius: ${props => (props.hasSquareCorners ? '0' : '8px 0 0 0')};
}
&:last-child {
border-radius: ${props => (props.hasSquareCorners ? '0' : '0 8px 0 0')};
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use our border radius variable

'border-radius',
magma.spaceScale.spacing03
`${magma.spaceScale.spacing03} 0 0 0`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should use magma.borderRadius instead of the spaceScale

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

@chris-cedrone-cengage chris-cedrone-cengage merged commit bbc13e6 into dev Jan 28, 2025
2 checks passed
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.

Table with dropdown: dropdown panel should overlay
2 participants