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

Enhance css reset #211

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Custom Selectors
* ...grouping of selectors to make life easier to manage
*/

/* All heading levels supported */
@custom-selector :--headings h1, h2, h3, h4, h5, h6;
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@import url("reset.css");
@import url("colors.css");
@import url("media-queries.css");
@import url("custom-selectors.css");
2 changes: 2 additions & 0 deletions themes/10up-theme/assets/css/frontend/02-global/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import url("reset.css");
@import url("mixins.css");
18 changes: 18 additions & 0 deletions themes/10up-theme/assets/css/frontend/02-global/mixins.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Mixins
* Use mixins to keep code DRY where viable
*/

/*
@define-mixin icon $name {
padding-left: 16px;
&::after {
content: "";
background: url(/icons/$(name).png);
}
}

.search {
@mixin icon search;
}
} */
83 changes: 83 additions & 0 deletions themes/10up-theme/assets/css/frontend/02-global/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/**
* Reset.css
* Custom reset enhancments.
* Primary reset is modern-normalize (by default)
* imported in ../style.css
*/

/*
* Reset spacing & font inheritance
*
* Font iheriance: We add intentional font inheritence as there are browser
* inconstencies as well as some instances where lacking implecit inheritence
* can cause challenges
*
* Margin & Padding reset: We reset margin and padding to 0 to ensure a
* consistentstarting point for all elements
*/
* {
font: inherit;
margin: 0;
padding: 0;
}

html {

/* enable dark and light color schemes by default */
color-scheme: dark light; /* stylelint-disable-line scale-unlimited/declaration-strict-value */
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to enable dark mode by default? We don't usually style for it unless it is a specific requests.

Also I don't think we should have to override our own linting rules in our scaffold.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think this enables dark mode by default, just that it allows it to be both dark and light


/* enable hanging punctuation */
hanging-punctuation: first last; /* stylelint-disable-line scale-unlimited/declaration-strict-value */
Copy link
Member

Choose a reason for hiding this comment

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

Same thing here with the stylelint override

}

/*
* Ensure body is at least 100% of viewport height
*/
body {
min-height: 100svh;
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we be using dvh here? (And provide a fallback for when the new unit isn't available?)

Suggested change
min-height: 100svh;
min-height: 100%;
min-height: 100dvh;

}

/*
* Responsive media
*/
img,
picture,
svg,
video {
display: block;
Copy link
Member

Choose a reason for hiding this comment

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

I'm a strong believer in setting images to display: flex in order to make them loose that odd additional spacing they always have at the bottom.

max-width: 100%;
}

:--headings {
text-wrap: balance;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
text-wrap: balance;
text-wrap: balance;
text-wrap: pretty; /* pretty is the nicer of the two algorythems. But it has less browser support so we want to have balance as a fallback */

}

p {

/*
* Adding a readable max width to all paragraphs to prevent
* long lines of text.
*
* NOTE: if using the lobomized owl technique - this style may be overridden
*/
max-width: 75ch; /* 75 characters - may wish to replace with custom property */
Copy link
Member

Choose a reason for hiding this comment

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

I think this is too opinionated for the scaffold

text-wrap: pretty;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
text-wrap: pretty;
text-wrap: balance;
text-wrap: pretty; /* pretty is the nicer of the two algorythems. But it has less browser support so we want to have balance as a fallback */

Copy link
Member

Choose a reason for hiding this comment

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

this has a negative impact on performance, while I was hesitant on all headings by default, definitely shouldn't happen on all paragraphs

}

/*
* Enable mooth scrolling by default
*/
@media (prefers-reduced-motion: no-preference) {

:has(:target) { /* include all elements with a target (i.e. html only will not include dialogs) */
scroll-behavior: smooth;
scroll-padding-top: var(--scroll-padding-default,); /* empty fallback if property doesn't exist */
}
}

/*
* Create a root stacking context
*/
.wp-site-blocks {
isolation: isolate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
*/
button:where(:not(.components-button)) {

/* styles here */
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
*/
a:where(:not(.components-external-link)) {

/* styles here */
}
13 changes: 0 additions & 13 deletions themes/10up-theme/assets/css/frontend/global/reset.css

This file was deleted.

13 changes: 8 additions & 5 deletions themes/10up-theme/assets/css/frontend/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,26 @@
*/
@import url("modern-normalize/modern-normalize.css");

/* Settings - settings like mixins, custom selectors, and custom properties */
@import url("01-settings/index.css");

/* Global - global pieces like media queries, mixins and placholders */
@import url("global/index.css");
@import url("02-global/index.css");

/* Base - base styles such as fonts, typography, and wordpress overrides */
@import url("base/index.css");
@import url("03-base/index.css");

/* Layout - styles specific to layout */

/* @import url("layout/index.css"); */
/* @import url("04-layout/index.css"); */

/* Templates */

/* @import url("templates/index.css"); */
/* @import url("05-templates/index.css"); */

/* Components */

@import url("components/index.css");
@import url("06-components/index.css");

/* Gutenberg blocks */

Expand Down