Skip to content

[mod_github_portfolio] support for dark mode#59

Merged
alikon merged 8 commits into
mainfrom
dark-mode
May 25, 2026
Merged

[mod_github_portfolio] support for dark mode#59
alikon merged 8 commits into
mainfrom
dark-mode

Conversation

@alikon
Copy link
Copy Markdown
Owner

@alikon alikon commented Apr 26, 2026

Summary by Sourcery

Add a dedicated stylesheet and CSS classes for the GitHub portfolio module to support dark mode and responsive styling, and wire it into the module assets.

Enhancements:

  • Move inline card styling to a reusable CSS class shared between legacy and new markup to improve maintainability and consistency.

Build:

  • Register the new CSS media folder and asset in the module manifest so the stylesheet is included with the module.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 26, 2026

Reviewer's Guide

Adds a dedicated stylesheet and semantic CSS class for the GitHub portfolio module to support dark mode and centralize styling, while wiring the new asset into the module manifest and template.

File-Level Changes

Change Details Files
Introduce a dedicated CSS asset for the GitHub portfolio module and load it from the module template.
  • Register and use a new stylesheet handle via the web asset manager in the module template
  • Point the stylesheet to the new github-portfolio.css file under the module media directory
src/modules/mod_github_portfolio/tmpl/default.php
Refine portfolio card markup to use a semantic CSS class instead of inline styles.
  • Replace inline background and border styles on portfolio cards with a new github-portfolio-card CSS class
  • Preserve existing Bootstrap utility classes for padding, rounding, shadow, and height
src/modules/mod_github_portfolio/media/js/github-portfolio.js
Wire the new CSS media folder into the module manifest so the asset is shipped and installed with the module.
  • Add a css folder entry to the module section to ensure CSS assets are deployed
src/modules/mod_github_portfolio/mod_github_portfolio.xml
Add a centralized stylesheet that defines light and dark mode-friendly styles for portfolio cards and related elements.
  • Define base card styles (background, border, radius, transitions) for .github-portfolio-module cards, supporting both legacy .pr-card and new .github-portfolio-card classes
  • Style primary outline buttons and status badges for consistent appearance
  • Add prefers-color-scheme: dark rules to adjust card colors in dark mode
  • Add responsive tweaks for small screens, including container padding and card spacing
src/modules/mod_github_portfolio/media/css/github-portfolio.css

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!

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
Copy Markdown
Contributor

@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 - I've found 1 issue, and left some high level feedback:

  • The new .github-portfolio-card class used in the JS doesn’t have any corresponding rules in github-portfolio.css (the CSS targets .github-portfolio-module .pr-card instead), so the card styling and intended dark-mode support likely won’t apply as expected; align the class names between JS and CSS.
  • By removing the inline backgroundColor and border on the card without reintroducing equivalent styles in the new stylesheet (including a dark-mode variant), the visual appearance may regress in light mode; consider moving those styles into github-portfolio.css alongside any dark-mode overrides.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `.github-portfolio-card` class used in the JS doesn’t have any corresponding rules in `github-portfolio.css` (the CSS targets `.github-portfolio-module .pr-card` instead), so the card styling and intended dark-mode support likely won’t apply as expected; align the class names between JS and CSS.
- By removing the inline `backgroundColor` and `border` on the card without reintroducing equivalent styles in the new stylesheet (including a dark-mode variant), the visual appearance may regress in light mode; consider moving those styles into `github-portfolio.css` alongside any dark-mode overrides.

## Individual Comments

### Comment 1
<location path="src/modules/mod_github_portfolio/media/js/github-portfolio.js" line_range="95" />
<code_context>
-      card.className = 'p-4 rounded shadow h-100';
-      card.style.backgroundColor = '#f8f9fa';
-      card.style.border = '1px solid #dee2e6';
+      card.className = 'p-4 rounded shadow h-100 github-portfolio-card';

       const h4 = document.createElement('h4');
</code_context>
<issue_to_address>
**issue (bug_risk):** Align the new `github-portfolio-card` class with the CSS selectors to avoid a visual regression.

Currently the CSS only styles `.github-portfolio-module .pr-card`, so `.github-portfolio-card` won’t receive the background/border styles, causing a visual regression. Either update the JS to use `pr-card` or extend the CSS to also target `.github-portfolio-card` so the styles apply.
</issue_to_address>

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.

Comment thread src/modules/mod_github_portfolio/media/js/github-portfolio.js
Added support for .github-portfolio-card and dark mode styles.
@alikon
Copy link
Copy Markdown
Owner Author

alikon commented Apr 27, 2026

@sourcery-ai review

Copy link
Copy Markdown
Contributor

@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 - I've found 1 issue, and left some high level feedback:

  • The new CSS comment /* Supporta sia .pr-card (retrocompatibilità) che .github-portfolio-card */ is in Italian while the rest of the module appears to use English, which may be confusing for maintainers; consider rewriting it in English for consistency.
  • In mod_github_portfolio.xml, the new <folder>css</folder> line uses a tab-based indentation that differs from the surrounding space-based indentation; align the indentation style with the existing XML for consistency.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new CSS comment `/* Supporta sia .pr-card (retrocompatibilità) che .github-portfolio-card */` is in Italian while the rest of the module appears to use English, which may be confusing for maintainers; consider rewriting it in English for consistency.
- In mod_github_portfolio.xml, the new `<folder>css</folder>` line uses a tab-based indentation that differs from the surrounding space-based indentation; align the indentation style with the existing XML for consistency.

## Individual Comments

### Comment 1
<location path="src/modules/mod_github_portfolio/media/css/github-portfolio.css" line_range="40-4" />
<code_context>
+}
+
+/* Responsive adjustments */
+@media (max-width: 768px) {
+    .github-portfolio-module .container {
+        padding-left: 15px;
+        padding-right: 15px;
+    }
+
+    .github-portfolio-module .pr-card,
+    .github-portfolio-module .github-portfolio-card {
+        margin-bottom: 1.5rem;
</code_context>
<issue_to_address>
**suggestion:** Narrow the `.container` selector to avoid unintentionally affecting nested containers.

This selector changes padding for every `.container` within `.github-portfolio-module`, including any nested containers from other components. To avoid unintended layout changes, target only the intended wrapper (e.g., by giving it a dedicated class) instead of the generic `.container`.

Suggested implementation:

```
/* Responsive adjustments */
@media (max-width: 768px) {
    /* Use a dedicated container class to avoid affecting nested .container elements */
    .github-portfolio-module .github-portfolio-container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .github-portfolio-module .pr-card,
    .github-portfolio-module .github-portfolio-card {
        margin-bottom: 1.5rem;
    }
}

```

To fully implement this change, update the module’s markup so that the intended layout wrapper inside `.github-portfolio-module` uses the new class. For example:
- Replace `class="container"` with `class="container github-portfolio-container"` (or add `github-portfolio-container` alongside any existing classes) on the specific wrapper element whose padding should change at this breakpoint.
This ensures only that wrapper gets the responsive padding while other nested `.container` elements remain unaffected.
</issue_to_address>

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.

/* GitHub Portfolio Module Styles */

/* Supporta sia .pr-card (retrocompatibilità) che .github-portfolio-card */
.github-portfolio-module .pr-card,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Narrow the .container selector to avoid unintentionally affecting nested containers.

This selector changes padding for every .container within .github-portfolio-module, including any nested containers from other components. To avoid unintended layout changes, target only the intended wrapper (e.g., by giving it a dedicated class) instead of the generic .container.

Suggested implementation:

/* Responsive adjustments */
@media (max-width: 768px) {
    /* Use a dedicated container class to avoid affecting nested .container elements */
    .github-portfolio-module .github-portfolio-container {
        padding-left: 15px;
        padding-right: 15px;
    }

    .github-portfolio-module .pr-card,
    .github-portfolio-module .github-portfolio-card {
        margin-bottom: 1.5rem;
    }
}

To fully implement this change, update the module’s markup so that the intended layout wrapper inside .github-portfolio-module uses the new class. For example:

  • Replace class="container" with class="container github-portfolio-container" (or add github-portfolio-container alongside any existing classes) on the specific wrapper element whose padding should change at this breakpoint.
    This ensures only that wrapper gets the responsive padding while other nested .container elements remain unaffected.

@alikon alikon merged commit eb43053 into main May 25, 2026
28 checks passed
@alikon alikon deleted the dark-mode branch May 25, 2026 14:35
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