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

ENH Prepare theme for adoption as a supported module #9

Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Dec 27, 2024

Important

You have to use the old name silverstripe-themes/startup as your dependency when testing this PR - composer seems to look at the composer.json in the base branch rather than the PR branch even when installing the PR as a fork

In addition to what's explicitly pointed out in comments below, the following changes were made:

  • add table styling (copied from simple theme)
  • add bottom margin to paragraphs
  • add $SilverStripeNavigator for logged-in users (shows whether you're viewing draft or live and gives edit button)
  • push footer to the bottom of the viewport when the page has too little content to scroll
  • fix bug where child of home page would show "Home /" twice in the breadcrumbs
  • move sidebar into its own template for easier overriding
  • add <base> tag and dir attribute

Issue

@GuySartorelli GuySartorelli marked this pull request as draft December 27, 2024 00:28
@GuySartorelli GuySartorelli force-pushed the pulls/main/adopt-theme branch 10 times, most recently from 04794fb to e350cbe Compare January 22, 2025 23:52
<link rel="manifest" href="$resourceURL('themes/startup/favicons/site.webmanifest')">
<link rel="mask-icon" href="$resourceURL('themes/startup/favicons/safari-pinned-tab.svg')" color="#051e2d">
<link rel="shortcut icon" href="$resourceURL('themes/startup/favicons/favicon.ico')">
<link rel="apple-touch-icon" sizes="180x180" href="$themedResourceURL('favicons/apple-touch-icon.png')">
Copy link
Member Author

Choose a reason for hiding this comment

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

$themedResourceURL means cascading themes can replace the favicon with something appropriate for a given project

@@ -6,6 +6,7 @@
<div class="page__content">
<h1 class="page__title">$Title</h1>
$Content
$ElementalArea
Copy link
Member Author

Choose a reason for hiding this comment

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

Elemental is used super often - makes sense to include it in the page layout template.
If there's no elemental area, this will do nothing so it does no harm by being included and makes it easier to use this theme (especially by maintainers who can now see the elemental area rendered without having to adjust anything from a fresh install)

Comment on lines -18 to +20
<script type="module" src="{$resourceURL('themes/startup/js/startup.js')}" defer></script>
<% if $HasPerm('CMS_ACCESS') %>$SilverStripeNavigator<% end_if %>
<script type="module" src="{$themedResourceURL('js/startup.js')}" defer></script>
Copy link
Member Author

@GuySartorelli GuySartorelli Jan 16, 2025

Choose a reason for hiding this comment

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

$themedResourceURL being used to match the <% require themedCSS('startup') %> further up which uses theme cascade.
Note we can't use a <% require %> directive for this js because there's no way to pass in an array, which would be needed to get the type and defer in there.

@@ -15,6 +15,7 @@
<% include Header %>
$Layout
<% include Footer %>
<script type="module" src="{$resourceURL('themes/startup/js/startup.js')}" defer></script>
<% if $HasPerm('CMS_ACCESS') %>$SilverStripeNavigator<% end_if %>
Copy link
Member Author

Choose a reason for hiding this comment

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

Adding $SilverStripeNavigator makes it easier to regression test that functionality, and is useful for authenticated users.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unused file

Copy link
Member Author

Choose a reason for hiding this comment

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

Unused file

Copy link
Member Author

Choose a reason for hiding this comment

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

Adds functional CSS to correspond with the accordion.js
Previously, CSS was applied only to narrow-scoped navigation-related CSS classes and was not reusable.

This both allows for additional accordions to be added using this JS (e.g. in an accordion elemental block) and allows the same functionality to be used for both mobile nav and desktop nav.

css/base.css Outdated
Comment on lines 111 to 113
.error.message {
color: var(--color-error);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Form validation messages - test using userforms.

css/header.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Changes here include:

  • Expand link to fill the whole tappable space in mobile nav (used to only be the text itself - tapping slightly to the side would do nothing)
  • Remove functional CSS that is now in the accordion styling
  • Remove on-hover expanding of desktop menu in favour of reusing existing accordion functionality
  • Update some styling for hover states and layout as appropriate to accomodate the above

@GuySartorelli GuySartorelli marked this pull request as ready for review January 23, 2025 01:14
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

I'm a bit confused by this PR, it seems like there's a bunch of changes made from what the Pikachu's originally did and was presumably signed off by the design team? Or have I misunderstood what this PR's doing?

Based on the notes in the original description it seemed like this PR should only be changing the composer name?

@GuySartorelli
Copy link
Member Author

GuySartorelli commented Jan 26, 2025

The work the Pikachus did was primarily for the purposes of the demo. This PR brings the theme up to a standard we'd be comfortable with for the default supported installer theme. These changes come after these acceptance criteria from the linked issue:

  • The theme gets a review from a "does this do what a default theme needs to do" pov
  • The theme gets a lightweight code quality review

In my view, the theme as it was before this PR is not of an appropriate standard, as it is missing some important styling (e.g. table styles, margin below paragraphs, some hover styles), is missing template variables that should be included (e.g. $ElementalArea), is missing some accessibility improvements (see changes to navigation), and isn't easily built on top of (e.g. $resourceURL instead of $themedResourceURL).

The changes I've made in this PR bring it to the minimum standard I'm comfortable with including as the default supported theme.

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

TinyMCE formatting doesn't work:

  • Bullet list
  • Numbered list
  • Align center
  • Align right
  • Justify
  • Italic displays as underline

Content block vertical spacing

In a content block context, along with the TinyMCE formatting points above, vertical spacing is also lacking when using the out of the box content block

"Home" in the navigation

In the breadcrumb the page "Home" is (incorrectly IMO) acting as the root page where pages like "About us" are treated as child pages, rather than sibling pages. I don't think we should show "Home" in the breadcrumb. You can simply click on the top-left logo to get back to the home page which is intuitive. Also just seeing the word "Home" looks weird, you don't see this on most websites.

Also I don't think "Home" should show in the top/accordian nav, as again you can just click the logo to go to the home page

Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Userform vertical spacing

In a userform context, along with the TinyMCE formatting points above, vertical spacing is lacking

Deeply nested pages don't work in accordion

In the accordion nav, sub-sub pages do not show

Excessive vertical space in breadcrumb

There is excessive vertical space between the breadcrumb and the header

@GuySartorelli
Copy link
Member Author

Discussed offline:

  • Vertical space for userform should be between each field holder
  • For nested pages, just add child pages into the sidebar

@GuySartorelli
Copy link
Member Author

Turns out most of the typography styling was in the wysiwyg.css file for some reason - which explicitly only applied to the WYSIWYG field in the CMS and not to the frontend.

I have now moved that out into the frontend CSS (which is also included in the WYSIWYG field in the CMS).

Italic displays as underline

This is the one thing I cannot reproduce.

@GuySartorelli
Copy link
Member Author

Content block vertical spacing

Assuming you mean space between blocks, this seems fine to me? Note that "Okie doke" is the end of one block, and "some block" is the start of the next one.
image

@GuySartorelli
Copy link
Member Author

GuySartorelli commented Jan 28, 2025

I don't think we should show "Home" in the breadcrumb. You can simply click on the top-left logo to get back to the home page which is intuitive. Also just seeing the word "Home" looks weird, you don't see this on most websites.

Agreed for the most part - except I've kept it there in the case where a child page is explicitly the child of the home page.

Also I don't think "Home" should show in the top/accordian nav, as again you can just click the logo to go to the home page

That can be configured in the CMS by setting "show in menus" to false. Because of this I won't change how the template handles it unless you insist.

@GuySartorelli GuySartorelli force-pushed the pulls/main/adopt-theme branch from e350cbe to 037cd69 Compare January 29, 2025 02:52
css/block.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Styles here weren't being used

css/hero.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Styles here weren't being used

css/section.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Styles here weren't being used

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to base to reduce number of network calls required to load all css since this is just a single declaration

css/wysiwyg.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved relevant styles to typography so they apply to frontend as well

@@ -70,7 +71,6 @@ img {
display: block;
height: auto;
max-width: 100%;
width: 100%;
Copy link
Member Author

Choose a reason for hiding this comment

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

Was overriding the height and width attributes from WYSIWYG

css/form.css Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Form styles adapted from simple theme

@GuySartorelli GuySartorelli force-pushed the pulls/main/adopt-theme branch from 037cd69 to cf44939 Compare January 29, 2025 03:26
Copy link
Member

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

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

Opened desktop "accordian" should close if click anywhere on page that's not the accordian

Set h1 margin-bottom: 2.4rem;

Set h2,h3,h4,h5,h6 margin-top: 2.4rem;

The right hand nav that shows on subpages

  • parent page link should be underlined to show that it's a link
  • on mobile, needs a thin grey horizontal line above it to denote that it's a nav section as moves from the right and will display underneath page content. Should remove the thin grey line below the parent page link on mobile view.

@GuySartorelli
Copy link
Member Author

Opened desktop "accordian" should close if click anywhere on page that's not the accordian

That's not how accordions tend to work - but I'll agree to doing this in the narrow scope of the menu. I'll add code for this that is specific to the menu or to some optional attribute that other accordions can choose to exclude.

parent page link should be underlined to show that it's a link

Oh, I didn't know that was a link lol. Will do.

@GuySartorelli
Copy link
Member Author

GuySartorelli commented Jan 30, 2025

Converted the rem margins to em so that they scale with font size.
I don't understand the reasoning behind the margin-top - ideally the separation would come down from the item above, but I've added it.

@GuySartorelli GuySartorelli force-pushed the pulls/main/adopt-theme branch from cf44939 to 0990299 Compare January 30, 2025 01:53
@GuySartorelli
Copy link
Member Author

Made the requested changes - also noted the JS was missing semicolons so I've plopped those in.

@emteknetnz emteknetnz merged commit 73b6db2 into silverstripe:main Jan 30, 2025
@emteknetnz emteknetnz deleted the pulls/main/adopt-theme branch January 30, 2025 21:47
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