-
Notifications
You must be signed in to change notification settings - Fork 566
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(examples): add tailwind preset example #1344
Conversation
This pull request is automatically being deployed by Amplify Hosting (learn more). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general, comments are pretty easy ones to address I think.
Thanks for taking the effort to rebase your earlier PR to SD v4 :) much appreciated.
@jessicalynch Is there anything I can help with here to move this along? Keen to use this functionality so I don't mind contributing some of the remaining PR feedback! |
Hey, thanks, I should be able to push my updates this weekend. This is just an example, though, so feel free to use the pattern anytime! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome job, just some final minor remarks, should be pretty easy to resolve. npx changeset
locally with a minor bump would be appreciated, since this example is basically a new feature that would have to be released on NPM as well. If you're limited time-wise I can also resolve these things and wrap this PR up later this week, just let me know!
0bf2888
to
b800806
Compare
Done- thank you for all the feedback! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet!
I've also forwarded the GH markdown issue to my GH contact and he contacted the team responsible for markdown parsing to html rendering for GH, they'll probably pick it up at some point.
I've also raised #1396 to make sure we change the old formats to using tabs for v5 major when we get to that.
Co-authored-by: Jessica Lynch <[email protected]>
This example doesn't allow for alpha values to be passed. Example: `bg-red/50' should have an opacity of 50% (documentation). To do so, please add Here's what the output should look like: ### themeColors.js
Tailwind theme color values that reference the plugin [css vars](https://tailwindcss.com/docs/customizing-colors#using-css-variables).
```js
export default {
'sd-text-base': 'rgb(var(--sd-text-base) / <alpha-value>)',
'sd-text-secondary': 'rgb(var(--sd-text-secondary) / <alpha-value>)',
'sd-text-tertiary': 'rgb(var(--sd-text-tertiary) / <alpha-value>)',
'sd-text-neutral': 'rgb(var(--sd-text-neutral))', // this one already has an opacity
'sd-theme': 'rgb(var(--sd-theme) / <alpha-value>)',
'sd-theme-light': 'rgb(var(--sd-theme-light) / <alpha-value>)',
'sd-theme-dark': 'rgb(var(--sd-theme-dark) / <alpha-value>)',
'sd-theme-secondary': 'rgb(var(--sd-theme-secondary) / <alpha-value>)',
'sd-theme-secondary-dark': 'rgb(var(--sd-theme-secondary-dark) / <alpha-value>)',
'sd-theme-secondary-light': 'rgb(var(--sd-theme-secondary-light) / <alpha-value>)',
};
``` |
Hm.. it's working for the Edit: it's working for me for bg-classes, too... I tried |
@kaelig, here's the tailwindcss reference I used- https://tailwindcss.com/docs/customizing-colors#using-css-variables If using CSS variables, they suggest defining them as channels without the color space function: :root {
--color-primary: 255 115 179;
--color-secondary: 111 114 185;
} /** @type {import('tailwindcss').Config} */
module.exports = {
theme: {
colors: {
primary: 'rgb(var(--color-primary))',
secondary: 'rgb(var(--color-secondary))',
}
}
} ...but I do remember seeing that I wasn't able to find it again in the docs and realized the modifiers worked without it, so I removed it: |
That's what I did at Netlify to enable support for the alpha modifier. Does the opacity modifier now work without alpha-value in the theme? |
Adds example for building a Tailwind preset from tokens.
Original PR: #1036
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.