Style fixes (#144)

* change "title__thicc" classname to "title--thicc" to reflect BEM naming convention

* fix indentation in index.njk

* add vertical spacing between homepage sections

* convert ".help" class to ".box__list" class

CSS classes generally shouldn't be related to content

* remove duplicate code for .page

* change auto-grid class to "auto-fit", from "auto-fill"

This reduces unused negative space on screens between 800-1200px wide

* use proper BEM practice - block, then modifier class

* refactor .flag styles to be more BEM

* add BEM block-level class to h1

* refactor box__list to simply "list"

* It will be its own component rather than element of the "box" block

* Remove duplicate (older) thicc styles from _header.scss

* rename .title--thicc to .thicc-headline to be more consistent with other "headline" heading classes

* rename another .title--thicc -> .thicc-headline

* refactor CSS selector from adjacent to class

* refactor the whole header to separate grid layout and typography

* remove unneeded grid style

* it's not a grid item

* remove sub-headline typography from _header.scss and add it to _typography.scss

* remove horizontal margin from box below tablet size

* noticed that the .box class, which is already squished on 320px wide screens, is more squished because of its margins.

* allow headings to wrap if necessary

noticed that headings (e.g. "development and build") were blowing out the grid on small screens and causing horizontal scroll

* rename subtitle to "sub-headline"

* convert <section> to <header>

makes more semantic sense for a screen-reader, since this really is the header of the document.

* discard heading wrapper element in favour of having just the heading element

Co-authored-by: Oscar <ovlb@users.noreply.github.com>
This commit is contained in:
Bashu Naimi-Roy 2020-05-28 04:01:04 -04:00 committed by GitHub
parent ba43ece075
commit 941403694a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 88 additions and 124 deletions

View File

@ -4,12 +4,12 @@
definition.data.flag and definition.data.flag and
definition.data.flag.text and definition.data.flag.text and
(definition.data.flag.level == 'avoid') -%} (definition.data.flag.level == 'avoid') -%}
<span class="flag__red">{{ definition.data.flag.text }}</span> <span class="flag flag--red">{{ definition.data.flag.text }}</span>
{%- elseif {%- elseif
definition.data.flag and definition.data.flag and
definition.data.flag.text and definition.data.flag.text and
(definition.data.flag.level == 'warning') -%} (definition.data.flag.level == 'warning') -%}
<span class="flag__yellow">{{ definition.data.flag.text }}</span> <span class="flag flag--yellow">{{ definition.data.flag.text }}</span>
{% endif %} {% endif %}
{%- if definition.data.sub_terms -%} {%- if definition.data.sub_terms -%}
<ul class="sub-terms" role="list" aria-label="{{definition.data.title}}"> <ul class="sub-terms" role="list" aria-label="{{definition.data.title}}">

View File

@ -1,4 +1,4 @@
<section> <section class="homepage-section homepage-section--toc">
<h2 id="terms-heading" class="visually-hidden">Terms</h2> <h2 id="terms-heading" class="visually-hidden">Terms</h2>
<nav class="" aria-labelledby="terms-heading"> <nav class="" aria-labelledby="terms-heading">
<ol class="multi-column u-no-padding-left list"> <ol class="multi-column u-no-padding-left list">

View File

@ -14,7 +14,7 @@
<a href={{ parent.href }}>{{ parent.title }}</a> <a href={{ parent.href }}>{{ parent.title }}</a>
</div> </div>
{% endif %} {% endif %}
<h1 class="title__thicc" >{{ title }}</h1> <h1 class="thicc-headline" >{{ title }}</h1>
{{ content | safe }} {{ content | safe }}
</main> </main>
{% endblock %} {% endblock %}

View File

@ -2,9 +2,11 @@
layout: layouts/index.njk layout: layouts/index.njk
--- ---
<section id="introduction" class="auto-grid"> <header class="auto-grid introduction">
<h1 class="title__thicc" id="title">Self-Defined</h1> <h1 class="introduction__title thicc-headline" id="title">
<p>A modern dictionary about us.<br>We define our words, but they don't define us.</p> Self-Defined
</h1>
<p class="introduction__body">A modern dictionary about us.<br>We define our words, but they don't define us.</p>
<div> <div>
<p class="summary"> <p class="summary">
Self-Defined seeks to provide more inclusive, holistic, and fluid definitions to reflect the diverse perspectives of the modern world. Self-Defined seeks to provide more inclusive, holistic, and fluid definitions to reflect the diverse perspectives of the modern world.
@ -14,11 +16,11 @@ layout: layouts/index.njk
</p> </p>
</div> </div>
<div class="box"> <div class="box">
<h2 class="subtitle">Ways to help</h2> <h2 class="sub-headline">Ways to help</h2>
<ol class="help"> <ol class="list">
<li>Submit words and definitions or contribute to our code base through <a href="https://github.com/tatianamac/selfdefined/pulls" rel="noreferral">pull requests</a> or <a href="https://github.com/tatianamac/selfdefined/issues" rel="noreferral">issues</a>. Start with our <a href="https://github.com/tatianamac/selfdefined/blob/master/CONTRIBUTING.md" rel="noreferral">contributing guidelines</a> and <a href="/documentation/">documentation</a>.</li> <li>Submit words and definitions or contribute to our code base through <a href="https://github.com/tatianamac/selfdefined/pulls" rel="noreferral">pull requests</a> or <a href="https://github.com/tatianamac/selfdefined/issues" rel="noreferral">issues</a>. Start with our <a href="https://github.com/tatianamac/selfdefined/blob/master/CONTRIBUTING.md" rel="noreferral">contributing guidelines</a> and <a href="/documentation/">documentation</a>.</li>
<li>Sponsor this work through <a href="https://opencollective.com/selfdefined">Open Collective</a> or <a href="https://github.com/sponsors/tatianamac">GitHub Sponsors</a>.</li> <li>Sponsor this work through <a href="https://opencollective.com/selfdefined">Open Collective</a> or <a href="https://github.com/sponsors/tatianamac">GitHub Sponsors</a>.</li>
<li>Follow us on Twitter <a href="https://www.twitter.com/selfdefinedapp">@SelfDefinedApp</a>.</li> <li>Follow us on Twitter <a href="https://www.twitter.com/selfdefinedapp">@SelfDefinedApp</a>.</li>
</ol> </ol>
</div> </div>
</section> </header>

View File

@ -23,6 +23,7 @@
// 6. Page-specific styles // 6. Page-specific styles
@import './layouts/pages'; @import './layouts/pages';
@import './layouts/homepage';
// 7. Themes // 7. Themes
// @import // @import

View File

@ -10,13 +10,6 @@
font-style: italic; font-style: italic;
} }
.help {
margin: 1rem 0;
li {
margin: 0.75rem 0;
}
}
.visually-hidden { .visually-hidden {
clip: rect(0 0 0 0); clip: rect(0 0 0 0);
clip-path: inset(100%); clip-path: inset(100%);

View File

@ -9,6 +9,7 @@ h3,
h4 { h4 {
margin-bottom: 0.5em; margin-bottom: 0.5em;
margin-top: 1em; margin-top: 1em;
word-break: break-word;
} }
p { p {
@ -17,42 +18,31 @@ p {
margin: 0.75rem 0; margin: 0.75rem 0;
} }
.title__thicc { .thicc-headline {
// a sensible base font size // a sensible base font size
font-size: 3rem; font-size: 3rem;
line-height: 0.75; line-height: 0.75;
margin: 0.5rem 0rem; margin: 0.5rem 0rem;
padding: 0; padding: 0;
// transform: rotateZ(90deg);
// margin: 13rem -7rem;
} }
@media (min-width: 51rem) and (min-height: 400px) { @media (min-width: 51rem) and (min-height: 400px) {
// a dramatic font size // a dramatic font size
.title__thicc { .thicc-headline {
font-size: 12vh; font-size: 12vh;
} }
} }
@media (min-width: 51rem) and (min-height: 850px) { @media (min-width: 51rem) and (min-height: 850px) {
// cap the max-height of the title // cap the maximum font size of the title
// at the same size that 12vh computes to // at the same size that 12vh computes to
// when the viewport is 850px high // when the viewport is 850px high
.title__thicc { // One day we can use CSS clamp https://caniuse.com/#feat=mdn-css_types_clamp
.thicc-headline {
font-size: 6.75rem; font-size: 6.75rem;
} }
} }
@media (min-width: 800px) {
.title__thicc {
grid-column: 1 / 3;
}
.title__thicc + p {
grid-column: 1 / 2;
}
}
.main-headline { .main-headline {
font-family: orpheuspro, Palatino, Times, serif; font-family: orpheuspro, Palatino, Times, serif;
font-size: 3.5rem; font-size: 3.5rem;
@ -60,11 +50,15 @@ p {
margin: 0; margin: 0;
} }
.subtitle { .sub-headline {
font-size: 1.25rem;
font-weight: bold;
}
.sub-headline {
font-family: $ext-sans; font-family: $ext-sans;
font-size: 1.25rem; font-size: 1.25rem;
font-weight: $regular; font-weight: $regular;
grid-column: span 2;
letter-spacing: 0.1; letter-spacing: 0.1;
margin: .75rem 0; margin: .75rem 0;
} }

View File

@ -1,5 +1,4 @@
.flag__red { .flag {
background-color:$lt-background-color;
border-radius: 1rem; border-radius: 1rem;
display: inline-block; display: inline-block;
font-size: 0.9rem; font-size: 0.9rem;
@ -7,25 +6,19 @@
margin: 0.5rem 0.75rem 0.25rem 0; margin: 0.5rem 0.75rem 0.25rem 0;
padding: 0.45rem 0.65rem; padding: 0.45rem 0.65rem;
text-transform: lowercase; text-transform: lowercase;
&--red {
background-color:$lt-background-color;
&:before { &:before {
@include icon__avoid(); @include icon__avoid();
@include icon__embed(); @include icon__embed();
} }
} }
&--yellow {
.flag__yellow {
background-color: $lt-background-color-warning; background-color: $lt-background-color-warning;
border-radius: 1rem;
display: inline-block;
font-size: 0.9rem;
font-weight: bold;
margin: 0.5rem 0.75rem 0.25rem 0;
padding: 0.45rem 0.65rem;
text-transform: lowercase;
&:before { &:before {
@include icon__warning(); @include icon__warning();
@include icon__embed(); @include icon__embed();
} }
}
} }

View File

@ -0,0 +1,7 @@
.homepage-section {
margin-top: calc(var(--l-gap) * 2);
@media (min-width: 800px) {
margin-top: calc(var(--l-gap) * 4);
}
}

View File

@ -10,7 +10,7 @@
display: grid; display: grid;
grid-gap: var(--l-gap); grid-gap: var(--l-gap);
grid-template-columns: repeat( grid-template-columns: repeat(
auto-fill, auto-fit,
minmax(var(--auto-grid-min-size), 1fr) minmax(var(--auto-grid-min-size), 1fr)
); );
} }
@ -51,23 +51,16 @@
grid-template-columns: 1fr 4fr; grid-template-columns: 1fr 4fr;
} }
.page {
align-items: start;
display: grid;
grid-template-columns: 1fr;
& > * {
grid-column: 1;
}
}
.box { .box {
background: black; background: black;
color: white; color: white;
grid-column: span 2; grid-column: span 2;
height: auto; height: auto;
margin: 1rem 0.5rem; margin: 1rem 0;
padding: 1rem; padding: 1rem;
@media (min-width: #{pxToRem(768)}) {
margin: 1rem 0.5rem;
}
a { a {
color: white; color: white;
@ -78,3 +71,13 @@
} }
} }
} }
.list {
margin: 1rem 0;
li {
margin: 0.75rem 0;
}
a {
word-break: break-word;
}
}

View File

@ -1,44 +1,15 @@
.title__thicc {
// a sensible base font size
font-size: 3rem;
line-height: 0.75;
margin: 0.5rem 0rem;
padding: 0;
// transform: rotateZ(90deg);
// margin: 13rem -7rem;
}
@media (min-width: 51rem) and (min-height: #{pxToRem(400)}) {
// a dramatic font size
.title__thicc {
font-size: 12vh;
}
}
@media (min-width: 51rem) and (min-height: #{pxToRem(850)}) {
// cap the max-height of the title
// at the same size that 12vh computes to
// when the viewport is 850px high
.title__thicc {
font-size: 6.75rem;
}
}
@media (min-width: #{pxToRem(800)}) {
.title__thicc {
grid-column: 1 / 3;
}
.title__thicc + p {
grid-column: 1 / 2;
}
}
.sub-headline {
font-size: 1.25rem;
font-weight: bold;
}
.summary { .summary {
grid-column: span 2; grid-column: span 2;
} }
@media (min-width: 800px) {
.introduction {
&__title {
grid-column: 1 / 3;
}
&__body {
grid-column: 1 / 2;
}
}
}