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

Let buttons get their styles from the theme #7587

Merged
merged 9 commits into from
Apr 16, 2024
Merged

Conversation

donnapep
Copy link
Collaborator

@donnapep donnapep commented Apr 10, 2024

Resolves #7090.

Proposed Changes

frontend.css is loaded for lessons in Learning Mode, even though LM lessons uses very little of the CSS in that file. This CSS file is responsible for styling buttons, which was the reason why the comment styling looked so bad.

To resolve this, this PR stops loading frontend.css for lessons in Learning Mode. To facilitate this change, it also:

  • Moves CSS specific to the Lesson Properties block out of frontend.scss and into a block-specific stylesheet (lesson-properties.scss).
  • Moves a bit of CSS needed for the Lesson Actions buttons to single-lesson-style.scss.
  • No longer styles buttons anywhere (Learning Mode and not), and instead lets the theme handle it.

Note that I didn't reference the Figma designs linked in the issue as it's no longer possible to see things like spacing, colors etc. without Figma's Dev Mode. So I just tried to make it look decent.

Testing Instructions

  1. Check out Update comments template to match latest Gutenberg block markup themes#7736.
  2. Open the Lesson (Learning Mode - Default) template in the site editor.
  3. Add the Comments block to the Main Content area.
  4. Add the Lesson Properties block to the Main Content area.
  5. Also add the Lesson Properties block to a lesson.
  6. On the frontend, add a few comments to that same lesson.
  7. Enable Learning Mode and the Course theme.
  8. Check that lesson comment styling looks good.
  9. Check that the Lesson Properties block styling looks good.
  10. Check other themes. The styling should look decent on other themes, not perfect, but the buttons should definitely not be the blue color they were before. They likely won't match the Lesson Actions button styles.
  11. Disable Learning Mode.
  12. Check that lesson comment styling looks good and the comment form buttons use the theme's styling. (To easily verify this, in a new tab add some comments to a post. Disable Sensei. Compare the comment buttons of the post to the lesson. They should look the same.)
  13. Check that the Lesson Properties block styling looks good.
  14. Check the lesson on different themes, including Course.

Note: There may be slight differences between the comments in Learning Mode vs. those in the legacy view (i.e. non-Learning Mode) for the Course theme, as the ones in the legacy view already have some non-default block settings set for the comment-related blocks in https://github.com/Automattic/themes/blob/trunk/course/patterns/comments.php. The differences will be theme-dependent.

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Legacy courses (course without blocks) are tested
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

Screenshots

No Learning Mode, Course Theme - Before

Screenshot 2024-04-11 at 12 14 47 PM

No Learning Mode, Course Theme - After

Screenshot 2024-04-11 at 12 11 32 PM

Learning Mode, Course Theme - After

Screenshot 2024-04-11 at 2 33 45 PM

@donnapep donnapep self-assigned this Apr 10, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

github-actions bot commented Apr 10, 2024

WordPress Dependencies Report

The github-action-wordpress-dependencies-report action has detected some script changes between the commit 0d4a268 and trunk. Please review and confirm the following are correct before merging.

Script Handle Added Dependencies Removed Dependencies Total Size Size Diff
blocks/single-lesson-style.js wp-polyfill 24 B +24 B ( +100% 🔼 )

This comment was automatically generated by the github-action-wordpress-dependencies-report action.

Sensei should not be so opinionated.
Copy link

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep added this to the 4.23.1 milestone Apr 11, 2024
@donnapep donnapep changed the title Fix comment styles Let buttons get their styles from the theme Apr 11, 2024
@donnapep donnapep marked this pull request as ready for review April 11, 2024 16:08
Copy link

Test the previous changes of this PR with WordPress Playground.

@donnapep donnapep requested a review from a team April 11, 2024 19:11
@merkushin
Copy link
Member

Tested it with the following themes: Course, Astra, Divi, 2021.

I noticed that in Astra without Learning Mode comments look not well. I'm attaching also a screenshot of a post page with comment where the comments look fine.

And in Divi with Learning Mode comments look also not well... And the comment submit button looks unstyled. (Screenshots below.)

Preparation:

Site Editor
Lesson Editor

With Learning Mode

Course Theme

Course w/ LM - comments
Course w/ LM - more comments
Course w/ LM - comment form and lesson properties

Astra

Astra w/ LM - comments
Astra w/ LM - comment form and lesson properties

Divi

Divi w/ LM - comments
Divi w/ LM - comment form and lesson properties

2021

2021 w/ LM

Without Learning Mode

Course Theme

Course w/o LM - comments
Course w/o LM - lesson properties

Astra

Astra w/o LM - comments
Astra w/o LM - lesson properties
Astra post comments

Divi

Divi w/o LM - comments
Divi w/o LM - lesson properties

2021

2021 w/o LM - comments
2021 w/o LM - lesson properties

@merkushin merkushin requested review from merkushin and removed request for a team April 12, 2024 03:07
@donnapep
Copy link
Collaborator Author

donnapep commented Apr 12, 2024

@merkushin I think a lot of that is expected. I concentrated primarily on making the Course theme comments look good, so if there are any issues there I would definitely want to fix those. After that, I concentrated on ensuring that the button styles matched what the theme uses. So for Astra, for example, the buttons now use Astra's button styles.

One improvement I will try to make in this PR is to have the non-block themes use Learning Mode's button styles instead of the theme's, but I don't think I'll attempt to fix any other sort of spacing issues (unless they didn't exist before this PR). Perhaps I'll open a separate issue for those and work on them next if it doesn't seem like it would be too much work. Changed my mind. There is other work that is higher priority. 🙂

merkushin
merkushin previously approved these changes Apr 15, 2024
Copy link
Member

@merkushin merkushin left a comment

Choose a reason for hiding this comment

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

Comments in the Course theme look good.

After that, I concentrated on ensuring that the button styles matched what the theme uses.

In Divi I noticed the submit button is unstyled at all, it uses neither Course theme styles, nor Divi styles.

Unstyled Divi button

But if our focus here is only on the Course theme, then it's fine.

@donnapep donnapep modified the milestones: 4.23.1, 4.23.2 Apr 15, 2024
Copy link

Test the previous changes of this PR with WordPress Playground.

@donnapep
Copy link
Collaborator Author

donnapep commented Apr 15, 2024

@merkushin I've updated the Post Comment button styles in Learning Mode for both classic and block themes in 0d4a268 and 3872b8a. The button should now look similar to the Next Lesson button, but without a border.

Divi

Screenshot 2024-04-15 at 3 45 18 PM

Note that I didn't attempt to style the Reply "button" as Divi is doing some fancy things there.

Twenty Twenty Four

Screenshot 2024-04-15 at 3 44 58 PM

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link

Test the previous changes of this PR with WordPress Playground.

Copy link
Member

@merkushin merkushin left a comment

Choose a reason for hiding this comment

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

Thanks for the update! The button looks good everywhere now! :)

@donnapep donnapep merged commit bc6a248 into trunk Apr 16, 2024
23 checks passed
@donnapep donnapep deleted the fix/style-comments branch April 16, 2024 12:07
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.

Style Comments block in Learning Mode
2 participants