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

Use theme colors for job overlay, improve dashboard on small screens #2810

Merged
merged 8 commits into from
Apr 25, 2024

Conversation

yscik
Copy link
Contributor

@yscik yscik commented Apr 22, 2024

Changes Proposed in this Pull Request

  • Expand the theme color detection script. Detect and calculate background and contrast colors based on the the theme.
    • Fixes color issues on dark themes, and daily chart colors when the link color is black.
  • Improve job dashboard table, add column labels on mobile, improve breaking points, tweak some styles
  • Fix outputting modal code multiple times

Testing Instructions

  • Enable stats
  • Install a few popular themes and check that the job dashboard and the stats overlay look reasonable out of the box
  • Twenty Twenty-Three, Twenty Twenty-Four has a bunch of color styles that are easy to switch in the site editor, including dark colors.
  • Check that the overlay also works in the admin

New or Updated Hooks and Templates

  • job_manager_ui_theme_support_script - disable theme color support script

Screenshot / Video

image image
Plugin build for df2ed43
📦 Download plugin zip
▶️ Open in playground

@yscik yscik requested review from gikaragia and a team April 22, 2024 16:29
@yscik yscik self-assigned this Apr 22, 2024
Copy link
Contributor

@gikaragia gikaragia left a comment

Choose a reason for hiding this comment

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

Although I think the solution is impressive, I also think that we may overcomplicate things while trying to make things look consistent. Maybe we should focus on simply providing the elements and let users handle more opinionated styles like colors?

Is it possible that having CSS variables makes it harder for our users to modify the colors as they will need to figure out how we use them? On the other side, maybe having variables is a common thing now and in the end they can always override everything so maybe it's not big of an issue.

templates/job-dashboard.php Outdated Show resolved Hide resolved
templates/job-dashboard.php Outdated Show resolved Hide resolved
includes/ui/class-ui.php Show resolved Hide resolved
includes/class-wp-job-manager.php Show resolved Hide resolved
includes/class-job-dashboard-shortcode.php Show resolved Hide resolved
assets/js/ui-theme-support.js Outdated Show resolved Hide resolved
assets/js/ui-theme-support.js Outdated Show resolved Hide resolved
assets/css/job-dashboard.scss Show resolved Hide resolved
assets/js/ui-theme-support.js Show resolved Hide resolved
@yscik
Copy link
Contributor Author

yscik commented Apr 24, 2024

So regarding CSS variables, the new styles rely pretty heavily on it, and it makes it pretty easy to customize things with just a few variables. This is an alternative to rewriting or overriding everything with CSS, which is what they currently have to do. I'm putting together a documentation page with some examples to get started.

This approach also makes it easy to add an UI on top in the future, where they can change the colors in the site editor or the setup wizard.

This PR adds the color detections so styles are not broken out of the box on various themes. Most of it is for the new overlay modal, where we'd end up with stuff like white links on white background if it's a dark theme.

@yscik
Copy link
Contributor Author

yscik commented Apr 24, 2024

Thanks for the review @gikaragia, all should be fixed now!

Copy link
Contributor

@gikaragia gikaragia left a comment

Choose a reason for hiding this comment

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

Looks great!

@yscik yscik merged commit ad9a9dc into trunk Apr 25, 2024
11 checks passed
@yscik yscik deleted the add/theme-fixes branch April 25, 2024 10:14
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.

2 participants