Skip to content

Commit eb663f3

Browse files
authored
4 Examples: Add "Open in Codepen" button to examples that use Font Awesome for Icon (pull #1685)
1. Adds font awesome icon stylesheet to Codepen options. Now, if font awesome is used in an example going forward, the icons will appear as expected when the example is opened in codepen. 2. Adds the Open In Codepen button to the two examples that use font awesome already: toolbar/toolbar.html and dialog-modal/datepicker-dialog.html. 3. Converts the treeview directory example to use font awesome icons for the folder and file icons and adds the "Open in Codepen" button to them: treeview/treeview-1/treeview-1a.html and treeview/treeview-1/treeview-1b.html
1 parent ea4ade3 commit eb663f3

File tree

10 files changed

+51
-17
lines changed

10 files changed

+51
-17
lines changed

.stylelintrc

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@
77
"ignoreMediaFeatureNames": [
88
"forced-colors"
99
]
10-
}
10+
},
11+
],
12+
"font-family-no-missing-generic-family-keyword": [
13+
true,
14+
{
15+
"ignoreFontFamilies": [
16+
"Font Awesome 5 Free"
17+
]
18+
},
1119
],
1220
"prettier/prettier": [true, {"singleQuote": false}]
1321
}

examples/dialog-modal/datepicker-dialog.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ <h1>Date Picker Dialog Example</h1>
4141
<li><a href="../combobox/combobox-datepicker.html">Date Picker Combobox</a>: An editable date input combobox that opens a dialog containing a calendar grid and buttons for navigating by month and year.</li>
4242
</ul>
4343
<section>
44-
<h2 id="ex_label">Example</h2>
44+
<div class="example-header">
45+
<h2 id="ex_label">Example</h2>
46+
</div>
4547
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep ex_label" aria-label="Start of"></div>
4648
<div id="example">
4749

@@ -641,7 +643,7 @@ <h3 id="rps_label_5">Date Picker Dialog: Date Grid</h3>
641643

642644
<section>
643645
<h2>Javascript and CSS Source Code</h2>
644-
<ul>
646+
<ul id="css_js_files">
645647
<li>
646648
CSS:
647649
<a href="css/datepicker-dialog.css" type="text/css">datepicker-dialog.css</a>
@@ -659,7 +661,7 @@ <h2 id="sc1_label">HTML Source Code</h2>
659661
<pre><code id="source1"></code></pre>
660662
<div role="separator" id="sc1_end_sep" aria-labelledby="sc1_end_sep sc1_label" aria-label="End of"></div>
661663
<script>
662-
sourceCode.add('source1', 'example');
664+
sourceCode.add('source1', 'example', 'ex_label', 'css_js_files');
663665
sourceCode.make();
664666
</script>
665667
</section>

examples/js/examples.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@ function addOpenInCodePenForm(
415415
css_external:
416416
location.origin +
417417
'/examples/css/core.css;' +
418-
'https://www.w3.org/StyleSheets/TR/2016/base.css',
418+
'https://www.w3.org/StyleSheets/TR/2016/base.css;' +
419+
'https://use.fontawesome.com/releases/v5.1.0/css/all.css',
419420
js_external: location.origin + 'examples/js/utils.js',
420421
};
421422

examples/toolbar/toolbar.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ <h1>Toolbar Example</h1>
4646
This example also illustrates the <a href="../../#kbd_roving_tabindex">roving tabindex method</a> for managing focus within a component.
4747
</p>
4848
<section>
49-
<h2 id="ex_label">Example</h2>
49+
<div class="example-header">
50+
<h2 id="ex_label">Example</h2>
51+
</div>
5052
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep ex_label" aria-label="Start of"></div>
5153
<div id="ex1">
5254
<div class="format" role="toolbar" aria-label="Text Formatting" aria-controls="textarea1">
@@ -954,7 +956,7 @@ <h3 id="rps_label_7">Spin Button (Font Size)</h3>
954956

955957
<section>
956958
<h2>Javascript and CSS Source Code</h2>
957-
<ul>
959+
<ul id="css_js_files">
958960
<li>CSS: <a href="css/toolbar.css" type="text/css">toolbar.css</a></li>
959961
<li>CSS: <a href="css/menuButton.css" type="text/css">menuButton.css</a></li>
960962
<li>Javascript: <a href="js/FormatToolbar.js" type="text/javascript">FormatToolbar.js</a></li>
@@ -976,7 +978,7 @@ <h2 id="sc1_label">HTML Source Code</h2>
976978
It renders the HTML in the preceding div with ID 'sc1'.
977979
-->
978980
<script>
979-
sourceCode.add('sc1', 'ex1');
981+
sourceCode.add('sc1', 'ex1', 'ex_label', 'css_js_files');
980982
sourceCode.make();
981983
</script>
982984
</section>

examples/treeview/treeview-1/css/tree.css

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ ul[role="tree"] {
66
}
77

88
[role="treeitem"].doc::before {
9-
content: url(../images/file.png);
9+
font-family: "Font Awesome 5 Free";
10+
content: "\f15c";
11+
display: inline-block;
12+
padding-right: 2px;
13+
padding-left: 5px;
14+
vertical-align: middle;
1015
}
1116

1217
[role="treeitem"][aria-expanded="false"] > ul {
@@ -18,11 +23,21 @@ ul[role="tree"] {
1823
}
1924

2025
[role="treeitem"][aria-expanded="false"] > span::before {
21-
content: url(../images/closed.png);
26+
font-family: "Font Awesome 5 Free";
27+
content: "\f07b";
28+
display: inline-block;
29+
padding-right: 3px;
30+
vertical-align: middle;
31+
font-weight: 900;
2232
}
2333

2434
[role="treeitem"][aria-expanded="true"] > span::before {
25-
content: url(../images/open.png);
35+
font-family: "Font Awesome 5 Free";
36+
content: "\f07c";
37+
display: inline-block;
38+
padding-right: 3px;
39+
vertical-align: middle;
40+
font-weight: 900;
2641
}
2742

2843
[role="treeitem"],
-194 Bytes
Binary file not shown.
-316 Bytes
Binary file not shown.
-289 Bytes
Binary file not shown.

examples/treeview/treeview-1/treeview-1a.html

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<script src="../../js/app.js"></script>
1313

1414
<link href="css/tree.css" rel="stylesheet">
15+
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css"
16+
integrity="sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt" crossorigin="anonymous">
1517

1618
<script type="text/javascript" src="js/tree.js"></script>
1719
<script type="text/javascript" src="js/treeitem.js"></script>
@@ -49,7 +51,9 @@ <h1>File Directory Treeview Example Using Computed Properties</h1>
4951
<li><a href="../treeview-navigation.html">Navigation Treeview Example</a></li>
5052
</ul>
5153
<section>
52-
<h2 id="start">Example</h2>
54+
<div class="example-header">
55+
<h2 id="start">Example</h2>
56+
</div>
5357
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep start" aria-label="Start of"></div>
5458
<div id="ex1">
5559
<h3 id="tree_label">
@@ -470,7 +474,7 @@ <h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
470474

471475
<section>
472476
<h2>Javascript and CSS Source Code</h2>
473-
<ul>
477+
<ul id="css_js_files">
474478
<li>
475479
CSS:
476480
<a href="css/tree.css" type="text/css">tree.css</a>
@@ -497,7 +501,7 @@ <h2 id="sc1_label">HTML Source Code</h2>
497501
<div role="separator" id="sc1_end_sep" aria-labelledby="sc1_end_sep sc1_label" aria-label="End of"></div>
498502

499503
<script>
500-
sourceCode.add('sc1', 'ex1');
504+
sourceCode.add('sc1', 'ex1', 'start', 'css_js_files');
501505
sourceCode.make();
502506
</script>
503507
</section>

examples/treeview/treeview-1/treeview-1b.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ <h1>File Directory Treeview Example Using Declared Properties</h1>
4343
<li><a href="../treeview-navigation.html">Navigation Treeview Example</a></li>
4444
</ul>
4545
<section>
46-
<h2 id="start">Example</h2>
46+
<div class="example-header">
47+
<h2 id="start">Example</h2>
48+
</div>
4749
<div role="separator" id="ex_start_sep" aria-labelledby="ex_start_sep start" aria-label="Start of"></div>
4850
<div id="ex1">
4951
<h3 id="tree1">File Viewer</h3>
@@ -659,7 +661,7 @@ <h2 id="rps_label">Role, Property, State, and Tabindex Attributes</h2>
659661

660662
<section>
661663
<h2>Javascript and CSS Source Code</h2>
662-
<ul>
664+
<ul id="css_js_files">
663665
<li>
664666
CSS:
665667
<a href="css/tree.css" type="text/css">tree.css</a>
@@ -686,7 +688,7 @@ <h2 id="sc1_label">HTML Source Code</h2>
686688
<div role="separator" id="sc1_end_sep" aria-labelledby="sc1_end_sep sc1_label" aria-label="End of"></div>
687689

688690
<script>
689-
sourceCode.add('sc1', 'ex1');
691+
sourceCode.add('sc1', 'ex1', 'start', 'css_js_files');
690692
sourceCode.make();
691693
</script>
692694
</section>

0 commit comments

Comments
 (0)