Main content.
diff --git a/components/layout/04-main-with-sidebar/01-main-with-sidebar/readme.md b/components/layout/04-main-with-sidebar/01-main-with-sidebar/readme.md index aa163d18..1d7215cd 100644 --- a/components/layout/04-main-with-sidebar/01-main-with-sidebar/readme.md +++ b/components/layout/04-main-with-sidebar/01-main-with-sidebar/readme.md @@ -1,5 +1,5 @@ -A block with a main column and one sidebar on either the left or right (this -example uses `mzp-l-sidebar-left`). A single page should only have one main +A block with a main column and one sidebar on either the start or end side (this +example uses `mzp-l-sidebar-start`). A single page should only have one main section and one sidebar. The columns will stack in small viewports, form a 1/3-2/3 split in medium sized @@ -15,9 +15,9 @@ styles. ### Tips -- Layout class `mzp-l-sidebar-left` or `mzp-l-sidebar-right` is required. -- The layout is reversed in right to left (RTL) languages; e.g., a left sidebar - will appear on the right. +- Layout class `mzp-l-sidebar-start` or `mzp-l-sidebar-end` is required. +- Start and end follow the text direction: a start sidebar appears on the left + in left to right (LTR) languages and on the right in right to left (RTL) languages. - The main content can be wrapped in any valid HTML element. We’re using `main` in this example but it could also be an `article`, `section`, `div`, etc. - The sidebar should usually be an `aside` element but you could use other elements. diff --git a/docs/02-usage/migration.md b/docs/02-usage/migration.md index ef470e27..08c18962 100644 --- a/docs/02-usage/migration.md +++ b/docs/02-usage/migration.md @@ -67,6 +67,18 @@ Find: mzp-c-(callout|card|menu-item|billboard)-desc Replace: mzp-c-$1-body ``` +Rename directional layout names from `left`/`right` to `start`/`end`. Affects Main with Sidebar and Article. + +```text +Find: mzp-l-sidebar-left +Replace: mzp-l-sidebar-start +``` + +```text +Find: mzp-l-sidebar-right +Replace: mzp-l-sidebar-end +``` + ### CSS Variable Renames (SCSS files) Font family and line-height variables: @@ -272,6 +284,11 @@ find . -name "*.scss" -exec sed -i '' -E 's/mzp-c-(menu|menu-item|menu-list|card find . -name "*.html" -exec sed -i '' -E 's/mzp-c-(callout|card|menu-item|billboard)-desc/mzp-c-\1-body/g' {} + find . -name "*.njk" -exec sed -i '' -E 's/mzp-c-(callout|card|menu-item|billboard)-desc/mzp-c-\1-body/g' {} + find . -name "*.scss" -exec sed -i '' -E 's/mzp-c-(callout|card|menu-item|billboard)-desc/mzp-c-\1-body/g' {} + + +# Rename directional layout names to start/end +find . -name "*.html" -exec sed -i '' -e 's/mzp-l-sidebar-left/mzp-l-sidebar-start/g' -e 's/mzp-l-sidebar-right/mzp-l-sidebar-end/g' {} + +find . -name "*.njk" -exec sed -i '' -e 's/mzp-l-sidebar-left/mzp-l-sidebar-start/g' -e 's/mzp-l-sidebar-right/mzp-l-sidebar-end/g' {} + +find . -name "*.scss" -exec sed -i '' -e 's/mzp-l-sidebar-left/mzp-l-sidebar-start/g' -e 's/mzp-l-sidebar-right/mzp-l-sidebar-end/g' {} + ``` ### CSS Variable Renames diff --git a/docs/03-contributing/02-naming.md b/docs/03-contributing/02-naming.md index 38a19f31..dce30d8c 100644 --- a/docs/03-contributing/02-naming.md +++ b/docs/03-contributing/02-naming.md @@ -72,6 +72,30 @@ by `l-` and `u-`) which you should only use when necessary and practical. In most cases there will be an equivalent SCSS mixin that may be preferable to adding presentational classes in your markup. +### Direction and Alignment + +Use `start` and `end` (and `reverse`) rather than `left` and `right` when naming +direction or alignment, matching CSS logical properties. Start and end follow +the text direction, so a `start` sidebar is on the left in left-to-right +languages and on the right in right-to-left languages. + +Billboard is an exception: its `mzp-l-billboard-left` and `mzp-l-billboard-right` +layouts intentionally don't reverse in right-to-left languages, so they keep +physical names. + +Animation names are also an exception: `@keyframes` can't read text direction, +so slide-in animations like `mzp-a-slide-in-left` keep physical names and are +swapped under `[dir='rtl']` instead. + +```scss +// NO - Physical +.mzp-l-sidebar-left { ... } + +// YES - Logical +.mzp-l-sidebar-start { ... } +.mzp-l-split-reversed { ... } +``` + ### Sizes We use a “T-shirt” convention when we need to describe sizes, e.g. “lg” for large