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(#1466): apply padding when variant=relaxed #1788

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

syedszeeshan
Copy link
Collaborator

@syedszeeshan syedszeeshan commented Apr 18, 2024

Instead of using JS for dom manipulation and adding 'relaxed' class to all eligible tds, the customElement is forced to spit out 'variant' attribute, and then the css selector goa-table[variant='relaxed'] td does work. See Chris' last comment below

image

@bdfranck
Copy link
Collaborator

Awesome! You could remove the old unused CSS:

goa-table.relaxed td {
padding: 1rem;
}

@syedszeeshan
Copy link
Collaborator Author

screenshot below after the above changes, Table with relaxed vs normal spacing

Playground-Table-relaxed-vs-normal

@ArakTaiRoth ArakTaiRoth linked an issue Apr 19, 2024 that may be closed by this pull request
@lizhuomeng71
Copy link
Collaborator

Issues is verified on Chrome, Firefox, and edge for react and angular, for mobile and desktop site
Screenshot 2024-04-19 141319

@lizhuomeng71 lizhuomeng71 marked this pull request as ready for review April 19, 2024 21:17
@chrisolsen
Copy link
Collaborator

chrisolsen commented Apr 19, 2024

I am pretty sure this can be fixed with the following updates to the component.css file. Note: Padding values used are just test values

goa-table[variant=normal] td {
  padding: 0.25rem; 
}

Below is what I now see when I set the table to compact
image

And Relaxed
image

@chrisolsen
Copy link
Collaborator

My code worked since I was testing via Angular which allowed the defined variant prop to be rendered in the DOM, then allowing my css selector to work; this did not work when testing in the Svelte playground.

To fix this problem the svelte:option needs to be changed to the following.

<svelte:options customElement={{
  tag: "goa-table",
  props: {
    variant: { reflect: true }
  }
}} />

This will ensure that the prop is visible in the DOM, and the previously defined css rule can take affect.

@ArakTaiRoth ArakTaiRoth merged commit c2dafaa into GovAlta:alpha Apr 24, 2024
1 check passed
@tzuge
Copy link
Collaborator

tzuge commented Apr 24, 2024

🎉 This PR is included in version 1.17.0-alpha.44 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tzuge tzuge added the released on @alpha Released into alpha. label Apr 24, 2024
@tzuge
Copy link
Collaborator

tzuge commented Apr 30, 2024

🎉 This PR is included in version 4.17.0-alpha.23 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tzuge
Copy link
Collaborator

tzuge commented May 13, 2024

🎉 This PR is included in version 1.20.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tzuge tzuge added the released Released into production. label May 13, 2024
@tzuge
Copy link
Collaborator

tzuge commented May 13, 2024

🎉 This PR is included in version 4.20.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tzuge
Copy link
Collaborator

tzuge commented Jun 27, 2024

🎉 This PR is included in version 3.0.0-alpha.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

@tzuge
Copy link
Collaborator

tzuge commented Jun 27, 2024

🎉 This PR is included in version 3.0.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released on @alpha Released into alpha. released Released into production.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Table's variant relaxed and normal
7 participants