Skip to content

Commit 93904d0

Browse files
authored
Merge pull request #45 from uswds/dw-temp-thing
Merging in newest edits
2 parents 3f9bec2 + 795d7fd commit 93904d0

4 files changed

Lines changed: 64 additions & 48 deletions

File tree

_includes/sxs/02-extending/part-one.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ <h3 class="step">Customize border settings.</h3>
1818
Let's start with the card border. We'll remove the border and make the card rounder by increasing the border radius.
1919
</p>
2020
<p class="step-description">
21-
We want to give our card a border radius of 2 units. To do that we'll set the value of the border radius to <strong>lg</strong> then set the value of the large border radius to 2.
21+
We want to give our card a border radius of 2 units. To do that we'll set the value of the global border radius to <strong>lg</strong> then set the value of the large border radius to 2.
2222
</p>
2323
<div class="editor">
2424
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/_uswds-theme.scss</h4>

_includes/sxs/02-extending/part-three.html

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
2222
</p>
2323
<div class="editor">
2424
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _includes/testimonial.html</h4>
25-
<pre class="blur">&lt;div class="my-testimonial"&gt;</pre>
26-
<pre class="add"> &lt;div class="my-testimonial__body"&gt;
27-
&lt;p&gt;
25+
<pre class="blur">&lt;div class="my-testimonial"&gt;
26+
&lt;div class="my-testimonial__body"&gt;</pre>
27+
<pre class="add"> &lt;p&gt;
2828
“One of the best USWDS tutorials I’ve followed all the way to the end.”
29-
&lt;/p&gt;
30-
&lt;/div&gt;</pre>
31-
<pre class="blur"> &lt;div class="my-testimonial__footer"&gt;&lt;/div&gt;
29+
&lt;/p&gt;</pre>
30+
<pre class="blur"> &lt;/div&gt;
31+
&lt;div class="my-testimonial__footer"&gt;&lt;/div&gt;
3232
&lt;/div&gt;
3333
</pre>
3434
</div>
@@ -46,18 +46,33 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
4646
&lt;p class="my-testimonial__profile-title"&gt;Participant&lt;/p&gt;
4747
&lt;/div&gt;
4848
</pre>
49-
<pre class="blur">&lt;/div&gt;</pre>
49+
<pre class="blur"> &lt;/div&gt;
50+
&lt;/div&gt;
51+
</pre>
5052
</div>
5153
<p class="step-description">
5254
Lastly, let's add a quotation icon for some visual flare! Visit the <a href="https://designsystem.digital.gov/components/icon/">Icon component</a> page, search for <strong>quote</strong>, and click the search result to copy the icons markup. Paste this markup directly after the opening <strong>my-testimonial</strong> div.
5355
</p>
5456
<div class="editor">
5557
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _includes/testimonial.html</h4>
5658
<pre class="blur">&lt;div class="my-testimonial"&gt;</pre>
57-
<pre class="add"> &lt;svg class="usa-icon my-testimonial__icon" aria-hidden="true" focusable="false" role="img"&gt;
59+
<pre class="add"> &lt;svg class="usa-icon" aria-hidden="true" focusable="false" role="img"&gt;
5860
&lt;use xlink:href="/assets/img/sprite.svg#format_quote"&gt;
5961
&lt;/use&gt;
6062
&lt;/svg&gt;</pre><pre class="blur">&lt;div class="my-testimonial__body"&gt;
63+
...</pre>
64+
</div>
65+
<p class="step-description">
66+
Next, add a class to the svg element for styling later, as well as height and width attributes to natively define the size of the icon.
67+
</p>
68+
<div class="editor">
69+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _includes/testimonial.html</h4>
70+
<pre class="blur">&lt;div class="my-testimonial"&gt;</pre>
71+
<pre class="remove"> &lt;svg class="usa-icon" aria-hidden="true" focusable="false" role="img"&gt;</pre>
72+
<pre class="add"> &lt;svg class="usa-icon my-testimonial__icon" height="50px" width="50px" aria-hidden="true" focusable="false" role="img"&gt;</pre>
73+
<pre class="blur"> &lt;use xlink:href="/assets/img/sprite.svg#format_quote"&gt;
74+
&lt;/use&gt;
75+
&lt;/svg&gt&lt;div class="my-testimonial__body"&gt;
6176
...</pre>
6277
</div>
6378
<p class="step-description">
@@ -66,7 +81,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
6681
<div class="editor">
6782
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _includes/testimonial.html</h4>
6883
<pre class="blur">&lt;div class="my-testimonial"&gt;
69-
&lt;svg class="usa-icon my-testimonial__icon" aria-hidden="true" focusable="false" role="img"&gt;</pre><pre class="remove">
84+
&lt;svg class="usa-icon my-testimonial__icon" height="50px" width="50px" aria-hidden="true" focusable="false" role="img"&gt;</pre><pre class="remove">
7085
&lt;use xlink:href="/assets/img/sprite.svg#format_quote"&gt;</pre><pre class="add">
7186
&lt;use xlink:href="/assets/uswds/img/sprite.svg#format_quote"&gt;</pre><pre class="blur">
7287
&lt;/use&gt;
@@ -81,10 +96,10 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
8196

8297
<h3 class="step">Add stylesheet partial.</h3>
8398
<p class="step-description">
84-
Create a new stylesheet partial for our new component by entering the following in the free temrinal window:
99+
Create a new stylesheet partial for our new component by entering the following in the free terminal window:
85100
</p>
86101
<div class="terminal">
87-
<pre>touch assets/css/components/_my-testimonial.scss</pre>
102+
<pre>touch _theme/components/_my-testimonial.scss</pre>
88103
</div>
89104
<p class="step-description">
90105
And then we'll import this new stylesheet into our USWDS custom styles.
@@ -93,15 +108,15 @@ <h3 class="step">Add stylesheet partial.</h3>
93108
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/_uswds-theme-custom-styles.scss</h4>
94109
<pre class="blur">@use "uswds-core" as *;
95110
@forward "../assets/css/styles.scss";
96-
@forward "../assets/css/_my-card.scss";
97-
</pre><pre class="add">@forward "../assets/css/_my-testimonial.scss";</pre>
111+
@forward "components/_my-card.scss";
112+
</pre><pre class="add">@forward "components/_my-testimonial.scss";</pre>
98113
</div>
99114
<h3 class="step">Start styling the component.</h3>
100115
<p class="step-description">
101-
Just like using the <strong>color()</strong> function to use USWDS color tokens, we can use <strong>units()</strong> and other token functions to use USWDS tokens in native CSS properties. To get our base styles for our new component, add the following styles to the new stylesheet:
116+
Just like using the <strong>color()</strong> function to use USWDS color tokens, we can use <strong>units()</strong> and other token functions to use tokens in native CSS properties. To get our base styles for our new component, add the following styles to the new stylesheet:
102117
</p>
103118
<div class="editor">
104-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
119+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
105120
<pre class="add">
106121
@use "uswds-core" as *;
107122

@@ -134,13 +149,13 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
134149
}
135150

136151
.my-testimonial__profile {
137-
margin-left: units(3)
152+
margin-left: units(3);
138153
}
139154

140155
.my-testimonial__profile-title {
141156
font-size: font-size("body", 5);
142157
margin-top: units(0);
143-
}
158+
}
144159
</pre>
145160
</div>
146161
<p class="step-description">
@@ -152,7 +167,7 @@ <h3 class="step">Style the testimonial icon.</h3>
152167
USWDS uses variables to maintain consistent styles across different definitions. Let's create a variable for our icon stroke and fill at the top of our stylesheet.
153168
</p>
154169
<div class="editor">
155-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
170+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
156171
<pre class="blur">@use "uswds-core" as *;
157172

158173
</pre>
@@ -181,7 +196,7 @@ <h3 class="step">Using USWDS theme tokens with mixins.</h3>
181196
Using a combination of utility mixins and USWDS theme settings can help add uniformity across your project. In this example, we'll add the border settings and padding settings from earlier to help our new component sit nicely with the original card. The <strong>u-margin-x()</strong> mixin lets you set left and right margin at the same time.
182197
</p>
183198
<div class="editor">
184-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
199+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
185200
<pre class="blur">.my-testimonial {</pre>
186201
<pre class="add"> @include u-border($theme-card-border-width);
187202
@include u-margin-x(1);
@@ -199,7 +214,7 @@ <h3 class="step">Adjusting color, background, and contrast.</h3>
199214
Finally, let's change the color of our testimonial component. The traditional way to set background and color is to use two separate rules. If we want to use our primary colors in this component, we can use the following two rules:
200215
</p>
201216
<div class="editor">
202-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
217+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
203218
<pre class="blur">.my-testimonial {
204219
@include u-border($theme-card-border-width);
205220
@include u-margin-x(1);
@@ -221,7 +236,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
221236
</p>
222237

223238
<div class="editor">
224-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
239+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
225240
<pre class="blur">.my-testimonial {
226241
@include u-border($theme-card-border-width);
227242
@include u-margin-x(1);
@@ -236,7 +251,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
236251
This time, when you save and compile you'll see a warning in the terminal. Let's update our code to use <strong>primary-lighter</strong> as our text color.
237252
</p>
238253
<div class="editor">
239-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-testimonial.scss</h4>
254+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-testimonial.scss</h4>
240255
<pre class="blur">.my-testimonial {
241256
@include u-border($theme-card-border-width);
242257
@include u-margin-x(1);

_includes/sxs/02-extending/part-two.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
2020

2121
<h3 class="step">Open a new terminal window.</h3>
2222
<p class="step-description">
23-
At this point you should already have two terminal windows open. One is serving our site and the other is compiling our stylesheets. We're going to open one more so we can add a couple new files.
23+
At this point you should already have two terminal windows open. One is serving our site and the other is compiling our stylesheets. We're going to open one more so we can add a couple new files.
2424
</p>
2525
<p class="step-description">
2626
Open a new terminal window and navigate to the tutorial's root directory, as before. In the following example, change <strong>path/to/uswds-tutorial</strong> to the actual path.
@@ -37,10 +37,10 @@ <h3 class="step">Create a custom stylesheet for our custom card component.</h3>
3737
<pre>mkdir _theme/components</pre>
3838
</div>
3939
<p class="step-description">
40-
Now let's add our new <strong>my-card</strong> stylesheet. It's standard naming convention to prefix CSS partials with an underscore (as we've already seen in <strong>_uswds-theme</strong> and <strong>_uswds-theme-custom-styles</strong>).
40+
Now let's add our new <strong>my-card</strong> stylesheet. It's standard naming convention to prefix SCSS partials with an underscore (as we've already seen in <strong>_uswds-theme</strong> and <strong>_uswds-theme-custom-styles</strong>).
4141
</p>
4242
<div class="terminal">
43-
<pre>touch assets/css/components/_my-card.scss</pre>
43+
<pre>touch _theme/components/_my-card.scss</pre>
4444
</div>
4545

4646
<h3 class="step">Import the new stylesheet into USWDS custom styles.</h3>
@@ -50,22 +50,22 @@ <h3 class="step">Import the new stylesheet into USWDS custom styles.</h3>
5050
<div class="editor">
5151
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/_uswds-theme-custom-styles.scss</h4>
5252
<pre class="blur">@use "uswds-core" as *;
53-
@forward "../assets/css/styles.scss";
54-
</pre><pre class="add">@forward "../assets/css/_my-card.scss";</pre>
53+
@forward "../assets/css/styles.scss";
54+
</pre><pre class="add">@forward "components/_my-card.scss";</pre>
5555
</div>
5656
<p class="step-description">
5757
Once you've updated this file, you can save and close it. Since we've added our project Sass source directory to our gulpfile in the first part of the tutorial, it should already be compiling correctly!
5858
</p>
5959
<p class="step-description">
60-
Now that our stylesheet is being imported, lets write some customs styles to finish up our card.
60+
Now that our stylesheet is being imported, lets write some customs styles to finish up our card.
6161
</p>
6262

6363
<h3 class="step">Use USWDS core features in custom styles.</h3>
6464
<p class="step-description">
65-
We'll want to use USWDS design tokens in our stylesheets using USWDS stylesheet features like functions and mixins. To do this, lets add <strong>uswds-core</strong> to the top of our new stylesheet with the <strong>use</strong> Sass directive.
65+
We'll want to use USWDS design tokens in our stylesheets using USWDS style features like functions and mixins. To do this, lets add <strong>uswds-core</strong> to the top of our new stylesheet with the <strong>use</strong> Sass directive.
6666
</p>
6767
<div class="editor">
68-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-card.scss</h4>
68+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-card.scss</h4>
6969
<pre class="add">@use "uswds-core" as *;</pre>
7070
</div>
7171

@@ -74,7 +74,7 @@ <h3 class="step">Add custom class and styles.</h3>
7474
Next lets create a custom class for our personalized component and use some USWDS utilities. We'll start by updating the background color of the card. We can use the <a href="https://designsystem.digital.gov/design-tokens/color/system-tokens/#using-color-tokens-2"><strong>color()</strong> function</a> to use color tokens in our CSS rules.
7575
</p>
7676
<div class="editor">
77-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-card.scss</h4>
77+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-card.scss</h4>
7878
<pre class="add">.my-card .usa-card__container {
7979
background-color: color("yellow-10");
8080
}</pre>
@@ -83,7 +83,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
8383
After recompiling we can see our changes have taken effect. Let's refine this card a bit more by reducing the boldness of the header and adding bit more space before the call to action. We'll use <a href="https://designsystem.digital.gov/design-tokens/spacing-units/">units tokens</a> and <a href="https://designsystem.digital.gov/design-tokens/typesetting/font-weight/">font weight tokens</a> for this.
8484
</p>
8585
<div class="editor">
86-
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> assets/css/components/_my-card.scss</h4>
86+
<h4 class="filename"><span class="material-icons" aria-hidden="true">description</span> _theme/components/_my-card.scss</h4>
8787
<pre class="blur">.my-card .usa-card__container {
8888
background-color: color("indigo-70v");
8989
}
@@ -97,7 +97,7 @@ <h4 class="filename"><span class="material-icons" aria-hidden="true">description
9797
}</pre>
9898
</div>
9999
<p class="step-description">
100-
Now we're making progress. This component is looking pretty good.
100+
Now we're making progress. This component is looking pretty good.
101101
</p>
102102
<p class="step-description">In our next section, we'll take a look at using everything USWDS has to offer to create a custom component!</p>
103103
</section>

assets/css/styles.css

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@
4545
}
4646
}
4747

48-
:where(html) {
48+
:where(html) {
4949
color: var(--text-2);
5050
background-color: var(--surface-1);
5151
}
5252

53-
:where(h1, h2, h3, h4, h5, h6, dt) {
53+
:where(h1, h2, h3, h4, h5, h6, dt) {
5454
color: var(--text-1);
5555
}
5656

@@ -103,7 +103,7 @@
103103
}
104104
}
105105

106-
:where(body) {
106+
:where(body) {
107107
min-block-size: 100%;
108108
scrollbar-gutter: stable both-edges;
109109
}
@@ -113,13 +113,13 @@
113113
font-weight: var(--font-weight-9);
114114
}
115115

116-
:is(h1) {
117-
font-size: var(--font-size-8);
118-
max-inline-size: var(--size-header-1);
116+
:is(h1) {
117+
font-size: var(--font-size-8);
118+
max-inline-size: var(--size-header-1);
119119
}
120120

121-
:is(h2) {
122-
font-size: var(--font-size-6);
121+
:is(h2) {
122+
font-size: var(--font-size-6);
123123
max-inline-size: var(--size-header-2);
124124
}
125125

@@ -210,10 +210,10 @@
210210
:is(code, kbd, samp, pre) { font-family: var(--font-mono) }
211211
:where(:not(pre) > code, kbd) { white-space: nowrap }
212212

213-
:is(pre) {
213+
:is(pre) {
214214
white-space: pre;
215215
min-inline-size: 0;
216-
max-inline-size: max-content;
216+
max-inline-size: max-content;
217217
}
218218

219219
:where(:not(pre) > code) {
@@ -244,8 +244,8 @@
244244
margin-block-start: var(--size-5);
245245
}
246246

247-
:where(small) {
248-
font-size: max(.5em, var(--font-size-0));
247+
:where(small) {
248+
font-size: max(.5em, var(--font-size-0));
249249
max-inline-size: var(--size-content-1);
250250
}
251251

@@ -442,6 +442,7 @@ main .part.intro {
442442
}
443443

444444
.part.intro > h1 {
445+
color: white;
445446
padding-top: var(--size-7)
446447
}
447448

@@ -581,7 +582,7 @@ main p a:active {
581582
padding-top: var(--size-2);
582583
}
583584

584-
.terminal,
585+
.terminal,
585586
.editor {
586587
font-size: var(--font-size-3);
587588
padding: var(--size-3);
@@ -752,4 +753,4 @@ a.contents-item:hover {
752753

753754
.contents-item .material-icons {
754755
margin-left: var(--size-1);
755-
}
756+
}

0 commit comments

Comments
 (0)