This repository has been archived by the owner on Oct 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 230
/
styleguide.njk
149 lines (140 loc) · 6.46 KB
/
styleguide.njk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
---
title: 'Styleguide'
permalink: /styleguide/
---
{% extends 'layouts/base.njk' %}
{# Intro content #}
{% set introHeading = title %}
{% block head %}
<style>
.swatches {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr));
grid-gap: 2.5rem 2rem;
margin-left: 0;
}
.swatches > * {
margin-top: 0 !important;
}
.props dt {
font-weight: 600;
}
.props dd + dt {
margin-top: 0.5rem;
display: block;
}
.color {
border: 1px solid var(--color-mid);
}
.bg-dark code {
color: var(--color-light);
}
</style>
{% endblock %}
{% block content %}
<main id="main-content" tabindex="-1">
{% include "partials/components/intro.njk" %}
<article class="[ inner-wrapper ] [ post ]">
<section class="[ post__body ] [ sf-flow ] [ pad-top-900 pad-bottom-900 ]">
<h2>Colours</h2>
<p class="visually-hidden">Colour swatches with various values that you can copy.</p>
<ul class="swatches">
{% for color in styleguide.colors() %}
<li class="sf-flow">
<div class="[ color ] [ pad-top-900 pad-bottom-900 ]" style="background: {{ color.value }}"></div>
<h3 class="font-base text-500">{{ color.key }}</h3>
<dl class="props">
<dt>Value</dt>
<dd><code>{{ color.value }}</code></dd>
<dt>Sass function</dt>
<dd><code>get-color('{{ color.key }}')</code></dd>
<dt>Custom Property</dt>
<dd><code>var(--color-{{ color.key }})</code></dd>
<dt>Text util class</dt>
<dd><code>color-{{ color.key }}</code></dd>
<dt>Background util class</dt>
<dd><code>bg-{{ color.key }}</code></dd>
</dl>
</li>
{% endfor %}
</ul>
<h2>Fonts</h2>
<h3>Base — System stack</h3>
<p class="sf-flow">
<span aria-hidden="true" role="presentation" class="font-base text-600 md:text-800 box-block leading-tight">The quick brown fox jumps over the lazy fox</span>
<code>.font-base</code>
</p>
<h3>Serif — Lora</h3>
<p class="sf-flow">
<span aria-hidden="true" role="presentation" class="font-serif text-600 md:text-800 box-block leading-tight">The quick brown fox jumps over the lazy fox</span>
<code>.font-serif</code>
</p>
<h2>Text sizes</h2>
<p>Text sizes are available as standard classes or media query prefixed, such as <code>lg:text-500</code>.</p>
{% for size in styleguide.sizes() %}
<p class="text-{{ size.key }}" style="--flow-space: 1.5rem">{{ size.value }} - <code>text-{{ size.key }}</code></p>
{% endfor %}
<h2>Spacing</h2>
<p>There’s size ratio utilities that give you margin (<code>gap-top, gap-bottom</code>) and padding (<code>pad-top, pad-left, pad-bottom</code>).
<h3>Margin</h3>
<p class="visually-hidden">Margin token classes that you can copy</p>
<div>
{% for size in styleguide.sizes() %}
<div class="[ bg-dark color-light pad-top-base pad-bottom-base pad-left-base md:width-half ] [ gap-top-{{ size.key }} ]">
<code>gap-top-{{ size.key }}</code>
</div>
{% endfor %}
</div>
<h3>Padding</h3>
<p class="visually-hidden">Padding token classes that you can copy</p>
{% for size in styleguide.sizes() %}
<div class="[ bg-dark pad-left-base color-light md:width-half ] [ pad-top-{{ size.key }} ]">
<code>pad-top-{{ size.key }}</code>
</div>
<div class="[ bg-dark pad-left-base color-light md:width-half ] [ pad-bottom-{{ size.key }} ]">
<code>pad-bottom-{{ size.key }}</code>
</div>
<div class="[ bg-dark color-light md:width-half ] [ pad-left-{{ size.key }} ]">
<code>pad-left-{{ size.key }}</code>
</div>
{% endfor %}
<h2>Forms</h2>
{% from "macros/form.njk" import label, field, textarea, confirm, select, radios, checkboxes, hidden_field, button %}
<form>
<ol class="[ field-list ]">
<li class="[ field-list__field-group ]">
{{ label("Text Label", "field-text-name") }}
{{ field( "text", "field-text-name", { required: true, placeholder: "Katherine Johnson", autocomplete: "name", autocorrect: "off", autocapitalize: "off", description: "Optional description. Note: This field type can take any valid input type." } ) }}
</li>
<li class="[ field-list__field-group ]">
{{ label("Email Label", "field-email-name") }}
{{ field( "email", "field-email-name", { required: true, placeholder: "katherine@johnson.tld", autocomplete: "email" } ) }}
</li>
<li class="[ field-list__field-group ]">
{{ label("Textarea Label", "field-textarea-name") }}
{{ textarea( "field-textarea-name", { required: true, autocapitalize: "sentences", spellcheck: "true" } ) }}
</li>
<li class="[ field-list__field-group ]">
{{ label("Select Label", "field-select-name") }}
{{ select( "select", [ "option 1", {label: "Option II", value: "option 2"} ], { required: true, options_before: ["prepended option"], options_after: ["appended option"], description: "Optional description." } ) }}
</li>
<li class="[ field-list__field-group field-list__field-group--confirm ]">
{{ confirm("Confirm this statement", "confirm") }}
</li>
<li class="[ field-list__field-group ]">
{{ radios("Radio Legend", "field-radio-name", [ "Yes", { label: "Not really", value: "No", note: "Note about choice." } ], { description: "Optional description." } ) }}
</li>
<li class="[ field-list__field-group ]">
{{ checkboxes("Checkbox Legend", "field-checkbox-name", [ "Choice 1", { label: "Choice 2", value: "Choice 2", note: "Note about choice." }, "Choice 3" ], { description: "Optional description." } ) }}
</li>
<li class="[ field-list__field-group ]">
There is a hidden field here…
{{ hidden_field("hidden-name", "hidden-value") }}
</li>
</ol>
{{ button("Button Text") }}
</form>
</section>
</article>
</main>
{% endblock %}