-
Notifications
You must be signed in to change notification settings - Fork 7
feat: declare theme variable for tailwindcss #117
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
Conversation
Signed-off-by: Lukas.J.Han <[email protected]>
Reviewer's Guide by SourceryThe pull request introduces a theme variable declaration for Tailwind CSS by extending the existing plugin to include a new theme configuration. This allows for the use of CSS variables within Tailwind's theme system, enabling more dynamic and customizable styling options. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @lukasjhan - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
@@ -1,280 +1,397 @@ | |||
const plugin = require('tailwindcss/plugin'); |
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.
issue (complexity): Consider extracting common CSS variables into a shared object to reduce duplication.
Consider extracting the common CSS variable definitions into a shared object. This minimizes duplication while still allowing you to override the values in the high-contrast mode. For example:
const sharedVars = {
'--krds-color-primary-5': '#ecf2fe',
'--krds-color-primary-10': '#d8e5fd',
'--krds-color-primary-20': '#b1cefb',
'--krds-color-primary-30': '#86aff9',
'--krds-color-primary-40': '#4c87f6',
'--krds-color-primary-50': '#256ef4',
'--krds-color-primary-60': '#0b50d0',
'--krds-color-primary-70': '#083891',
'--krds-color-primary-80': '#052561',
'--krds-color-primary-90': '#03163a',
'--krds-color-primary-95': '#020f27',
// ...other shared variables
};
const highContrastOverrides = {
'--krds-color-secondary-5': '#edf6f8',
'--krds-color-secondary-10': '#d5ebf1',
'--krds-color-secondary-20': '#abd8e3',
'--krds-color-secondary-30': '#75c0d1',
'--krds-color-secondary-40': '#3d9fb8',
'--krds-color-secondary-50': '#268097',
'--krds-color-secondary-60': '#1f687a',
'--krds-color-secondary-70': '#17505e',
'--krds-color-secondary-80': '#113b45',
'--krds-color-secondary-90': '#0e3139',
'--krds-color-secondary-95': '#091f25',
// ...if there are other overrides, list them here
};
addBase({
':root': {
...sharedVars,
// additional unique variables for base theme
},
'[data-theme="high-contrast"]': {
...sharedVars,
...highContrastOverrides,
},
});
This refactoring reduces the repetition and makes future maintenance easier by centralizing the shared values.
Summary by Sourcery
New Features: