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

Add body class for theme variations #7432

Merged
merged 5 commits into from
Oct 31, 2023

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Oct 17, 2023

Changes proposed in this Pull Request:

  • We've added a custom property in each variation which we later parse and add in body class from sensei. Allows us to add CSS using CSS files.
  • Added a hook course_theme_variation_loaded, description is added below.
  • Added stylesheets hooked to the action above, loading variation specific stylesheets.

Added hook

course_theme_variation_loaded - Fires after the variation is determined, can be used for different use cases, including loading variation specific stylesheets

Details in this PR Automattic/sensei#7225

@Imran92 Imran92 added this to the Course 1.3.5 milestone Oct 17, 2023
@Imran92 Imran92 requested a review from a team October 17, 2023 16:21
@Imran92 Imran92 self-assigned this Oct 17, 2023
@Imran92
Copy link
Contributor Author

Imran92 commented Oct 31, 2023

Hi @donnapep 👋

As per our discussion here Automattic/sensei#7225, I've moved the functionality here.

It gives us the added advantage of not having to check which theme is in use.

Also, I've added a hook which can be used from sensei or any other place to enqueue variation specific stylesheets.

I've also added stylesheets for each variation.

Once we have this PR approved, we can close the associated PR in Sensei because we won't need that anymore. Also, we can share our approach in the theme team's issue.

Thanks!

course/functions.php Outdated Show resolved Hide resolved
@donnapep donnapep self-requested a review October 31, 2023 17:12
Copy link
Contributor

@donnapep donnapep left a comment

Choose a reason for hiding this comment

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

Left a wee comment about not using $$next-version$$ in this repo.

@Imran92 Imran92 merged commit be3d365 into feature/frontend-improvements Oct 31, 2023
@Imran92 Imran92 deleted the add/body-class-for-variation branch October 31, 2023 17:22
@donnapep donnapep changed the title Course: Add body class for theme variations Add body class for theme variations Oct 31, 2023
renatho pushed a commit that referenced this pull request Nov 1, 2023
* Update styles of question feedback (#7373)

* Specify the grade style to be applied only in the question header

* Update background color for gold variation

* Update background color for default variation

* Update border color for gold variation

* Tweak CSS formatting

* Tweak color for border of ordering question

---------

Co-authored-by: Donna Peplinskie <[email protected]>

* Update version and description

* Add new changelog

* Remove legacy Learning Mode CSS as it's part of Sensei now (#7431)

* Course: Add body class for theme variations (#7432)

* Add custom property with variation name

* Add function to add body class and enqueue proper stylesheets

* Add stylesheets for all variations

* Add version number

* Style the "Awaiting Grade" notice (#7401)

* Style "Awaiting Grade" notice

* Move custom CSS to other areas of theme.json

* Remove typography setting as it needs to be done via CSS

* Do the same for the variations

* Fix notice style getting broken for css parsing issue

---------

Co-authored-by: Imran Hossain <[email protected]>

* Bump versions and update change log

---------

Co-authored-by: Imran Hossain <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants