You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _includes/sxs/02-extending/part-intro.html
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
<h1>Part Two</h1>
3
3
<h2>Theming, customizing, extending</h2>
4
4
<pclass="subhed">Take USWDS and make it your own.</p>
5
-
<pclass="subhed">In this section of the tutorial, you'll expand on theming components. Then you'll learn creating custom project styles for our components. Finally, you'll exend a component to create a custom component!</p>
5
+
<pclass="subhed">In this section of the tutorial, you'll expand on theming components. Then you'll learn creating custom project styles for our components. Finally, you'll extend a component to create a custom component!</p>
Copy file name to clipboardExpand all lines: _includes/sxs/02-extending/part-three.html
+62-46Lines changed: 62 additions & 46 deletions
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,19 @@
1
1
<sectionclass="part three" id="part-three">
2
2
<h2><span>Part Three</span> Create a custom component</h2>
3
-
<p>In this section we'll explore extending USWDS by creating a custom <strong>testmionial</strong> component not offered by the design system.</p>
3
+
<p>In this section we'll explore extending USWDS by creating a custom <strong>testimonial</strong> component not offered by the design system.</p>
4
4
<h3class="step">Create a the markup for a new component.</h3>
5
5
<pclass="step-description">
6
6
Visit <strong>_includes/sxs/02-extending/testimonial.html</strong>. This will be where we will add the markup for our new component. Once the markup is filled out, it will appear beneath our custom card component!
7
7
</p>
8
8
<pclass="step-description">
9
-
Start by adding the basic skeleton of the component. We'll need an outer div, a body, and footer section. We'll call this component <strong>ut-testimonial</strong>.
9
+
Start by adding the basic skeleton of the component. We'll need an outer div, a body, and footer section. We'll call this component <strong>my-testimonial</strong>.
Lastly, lets add a quotation icon for some visual flare! Visit the <ahref="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>ut-testimonial</strong> div.
52
+
Lastly, lets add a quotation icon for some visual flare! Visit the <ahref="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.
Just like using the <strong>color()</strong> function to use USWDS color tokens, we can use <strong>units()</strong> to allow native CSS properties to make use of USWDS spacing tokens. To get our base styles for our new component, add the following styles to the new stylesheet.
USWDS uses variables to maintain consistent styles across different definitions. Lets create a variable for our icon stroke and fill at the top of our stylesheet.
130
+
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.
USWDS also offers an extensive library of utility mixins which you can use to simplify style setting. Let's use some of the typeset mixins to customize our font weight and size. It's standard convention to include your mixins at the top of each style definition.
Finally, lets use a combination of utility mixins and uswds theme settings to display how you can add uniformity across your project! In this example, we'll add the border settings from step one to help our new component sit nicely with the original card.
Copy file name to clipboardExpand all lines: _includes/sxs/02-extending/part-two.html
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ <h3 class="step">Add a custom class for our new variant.</h3>
8
8
We'll use this class to identify our custom card component and assign custom styles.
9
9
</p>
10
10
<pclass="step-description">
11
-
When adding custom classes we recommend using a two to threeletter prefix to identify the organization it belongs to. USWDS primarily uses <strong>usa-</strong>. Since this is your tutorial, lets use <strong>my-</strong>card as our custom class.
11
+
When adding custom classes we recommend using a two- to three-letter prefix for clear identification. USWDS primarily uses <strong>usa-</strong>. Since this is your tutorial, lets use <strong>my-</strong>card as our custom class.
@@ -31,10 +31,10 @@ <h3 class="step">Open a new terminal window.</h3>
31
31
32
32
<h3class="step">Create a custom stylesheet for our custom card component.</h3>
33
33
<pclass="step-description">
34
-
To help keep things organized, we'll create a custom stylesheet with styles specific to our customized card component. In later excercises, we'll use this same stylesheet to extend the card component into a new custom component. First, lets add a <strong>components</strong> directory to our css assets.
34
+
To help keep things organized, we'll create a custom stylesheet with styles specific to our customized card component. In later exercises, we'll use this same stylesheet to extend the card component into a new custom component. First, lets add a <strong>components</strong> directory to our css assets.
35
35
</p>
36
36
<divclass="terminal">
37
-
<pre>mkdir assets/css/components</pre>
37
+
<pre>mkdir _theme/components</pre>
38
38
</div>
39
39
<pclass="step-description">
40
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>).
Next lets create a custom class for our personalized component and use some USWDS utiltities. We'll start by updating the background color of the card. We can use the <ahref="https://designsystem.digital.gov/design-tokens/color/system-tokens/#using-color-tokens-2"><strong>color()</strong> function</a> to set the text and background color with USWDS <ahref="https://designsystem.digital.gov/design-tokens/color/overview/">color tokens</a>.
73
+
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 <ahref="https://designsystem.digital.gov/design-tokens/color/system-tokens/#using-color-tokens-2"><strong>color()</strong> function</a> to set the text and background color with USWDS <ahref="https://designsystem.digital.gov/design-tokens/color/overview/">color tokens</a>.
Before we go, we'll need to add a little additonal functionality to our stylesheets. We'll need USWDS Utilities and the USWDS Layout Grid for the next part of the tutorial, so let's add them now, just before custom styles. Give it a save and head on to Part Two!
8
+
Before we go, we'll need to add a little additional functionality to our stylesheets. We'll need USWDS Utilities and the USWDS Layout Grid for the next part of the tutorial, so let's add them now, just before custom styles. Give it a save and head on to Part Two!
0 commit comments