Skip to content

Conversation

lukasjhan
Copy link
Member

@lukasjhan lukasjhan commented Mar 16, 2025

Summary by Sourcery

New Features:

  • Introduce theme variables for Tailwind CSS to allow for easier customization and theming.

@lukasjhan lukasjhan self-assigned this Mar 16, 2025
Copy link

sourcery-ai bot commented Mar 16, 2025

Reviewer's Guide by Sourcery

The 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

Change Details Files
Refactor and extend Tailwind CSS plugin to declare theme variables.
  • Refactored the existing plugin function to include a new theme configuration.
  • Added a new theme extension that maps CSS variables to Tailwind's color system.
  • Reorganized the existing CSS variable declarations to fit within the new plugin structure.
packages/tailwindcss-plugin/krds-plugin.js

Possibly linked issues

  • 모노레포 셋팅 #1: The PR declares theme variables, aligning with the issue's goal to create a TailwindCSS plugin.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a 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

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
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');
Copy link

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.

@lukasjhan lukasjhan merged commit 833c09d into KRDS-community:main Mar 16, 2025
4 checks passed
@lukasjhan lukasjhan deleted the feat/design-token-1 branch March 16, 2025 14:20
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.

1 participant