|
1 | 1 | <html lang="en"> |
2 | 2 | {% block head %} |
3 | | - {% block stylesheets %} |
4 | | - <style> |
5 | | - {{ include('@TwigDoc/style/style.css.twig') }} |
6 | | - </style> |
7 | | - {% endblock %} |
| 3 | +{% block stylesheets %} |
| 4 | + <style> |
| 5 | + {{ include('@TwigDoc/style/style.css.twig') }} |
| 6 | + </style> |
| 7 | +{% endblock %} |
8 | 8 | <title>{% block title %}Twig Component Documentation{% endblock %}</title> |
9 | | - {% block javascripts %} |
10 | | - {% endblock %} |
| 9 | +{% block javascripts %} |
| 10 | + <script type="application/javascript"> |
| 11 | + window.addEventListener('load', () => { |
| 12 | + document.querySelectorAll('.twig-doc-variation h5').forEach( |
| 13 | + function (element) { |
| 14 | + element.addEventListener('click', function () { |
| 15 | + console.log(element); |
| 16 | + let variation = element.getAttribute('data-variation'); |
| 17 | + element.parentNode.querySelectorAll('.twig-doc-variation-body, h5').forEach( |
| 18 | + function (e) { |
| 19 | + e.classList.remove('active'); |
| 20 | + }); |
| 21 | + element.classList.add('active'); |
| 22 | + element.parentNode.querySelector(`.twig-doc-variation-body[data-variation="${variation}"]`).classList.add('active'); |
| 23 | + }) |
| 24 | + } |
| 25 | + ) |
| 26 | + }); |
| 27 | + </script> |
| 28 | +{% endblock %} |
11 | 29 | {% endblock %} |
12 | 30 | </html> |
13 | 31 |
|
14 | 32 | <body> |
15 | 33 | {% block body %} |
16 | | -<div id="twig-doc-container"> |
| 34 | + <div id="twig-doc-container"> |
17 | 35 |
|
18 | | - <div class="breakpoints"> |
19 | | - <div id="screenwidth"></div> |
20 | | - <div class="one"></div> |
21 | | - <div class="two"></div> |
22 | | - <div class="three"></div> |
23 | | - <div class="four"></div> |
24 | | - <div class="five"></div> |
25 | | - <div class="six"></div> |
26 | | - <div class="seven"></div> |
27 | | - <div class="eight"></div> |
28 | | - </div> |
29 | | - <!-- find better solution --> |
30 | | - <script> |
31 | | - function widthResizer(){ |
32 | | - var width = window.innerWidth |
33 | | - if(document.getElementById("screenwidth")) { |
34 | | - document.getElementById("screenwidth").innerHTML = "Width: " + width + "px" |
| 36 | + <div class="breakpoints"> |
| 37 | + <div id="screenwidth"></div> |
| 38 | + <div class="one"></div> |
| 39 | + <div class="two"></div> |
| 40 | + <div class="three"></div> |
| 41 | + <div class="four"></div> |
| 42 | + <div class="five"></div> |
| 43 | + <div class="six"></div> |
| 44 | + <div class="seven"></div> |
| 45 | + <div class="eight"></div> |
| 46 | + </div> |
| 47 | + <!-- find better solution --> |
| 48 | + <script> |
| 49 | + function widthResizer() { |
| 50 | + var width = window.innerWidth |
| 51 | + if (document.getElementById("screenwidth")) { |
| 52 | + document.getElementById("screenwidth").innerHTML = "Width: " + width + "px" |
| 53 | + } |
| 54 | + console.log(width) |
35 | 55 | } |
36 | | - console.log(width) |
37 | | - } |
38 | 56 |
|
39 | | - // Getting the width of the browser on load |
40 | | - widthResizer() |
| 57 | + // Getting the width of the browser on load |
| 58 | + widthResizer() |
41 | 59 |
|
42 | | - // Getting the width of the browser whenever the screen resolution changes. |
43 | | - window.addEventListener('resize', widthResizer) |
44 | | - </script> |
| 60 | + // Getting the width of the browser whenever the screen resolution changes. |
| 61 | + window.addEventListener('resize', widthResizer) |
| 62 | + </script> |
45 | 63 |
|
46 | | - {% include '@TwigDoc/component/_search.html.twig' %} |
| 64 | + {% include '@TwigDoc/component/_search.html.twig' %} |
47 | 65 |
|
48 | | - {% if not components %} |
49 | | - <div class="twig-doc-error"> |
50 | | - No components found |
51 | | - </div> |
52 | | - {% endif %} |
53 | | - <div class="twig-doc-body"> |
| 66 | + {% if not components %} |
| 67 | + <div class="twig-doc-error"> |
| 68 | + No components found |
| 69 | + </div> |
| 70 | + {% endif %} |
| 71 | + <div class="twig-doc-body"> |
54 | 72 |
|
55 | | - {# <button onClick="setScreenwidth('small');">S</button> |
| 73 | + {# <button onClick="setScreenwidth('small');">S</button> |
56 | 74 | <button onClick="setScreenwidth('medium');">M</button> |
57 | 75 | <button onClick="setScreenwidth('large');">L</button> |
58 | 76 | <button onClick="setScreenwidth('default');">Default</button> #} |
59 | 77 |
|
60 | | - <div class="navigation"> |
61 | | - <ul> |
62 | | - <li> |
63 | | - <a href="?filterQuery=Atoms&filterType=category">Atoms</a> |
64 | | - <ul> |
65 | | - <li><a href="?filterQuery=Buttons&filterType=sub_category">Buttons</a></li> |
66 | | - <li><a href="?filterQuery=Typography&filterType=sub_category">Typography</a></li> |
67 | | - </ul> |
68 | | - </li> |
69 | | - <li><a href="?filterQuery=Commons&filterType=category">Commons</a></li> |
70 | | - <li><a href="?filterQuery=Snippets&filterType=category">Snippets</a></li> |
71 | | - <li><a href="?filterQuery=Blocks&filterType=category">Blocks</a></li> |
72 | | - <li><a href="?filterQuery=Templates&filterType=category">Templates</a></li> |
73 | | - </ul> |
74 | | - </div> |
75 | | - |
76 | | - {% for items in components %} |
77 | | - <div> |
78 | | - {% for item in items %} |
79 | | - {% include '@TwigDoc/component/_item.html.twig' with { component: item }%} |
80 | | - {% endfor %} |
| 78 | + <div class="navigation"> |
| 79 | + <ul> |
| 80 | + <li> |
| 81 | + <a href="?filterQuery=Atoms&filterType=category">Atoms</a> |
| 82 | + <ul> |
| 83 | + <li><a href="?filterQuery=Buttons&filterType=sub_category">Buttons</a></li> |
| 84 | + <li><a href="?filterQuery=Typography&filterType=sub_category">Typography</a></li> |
| 85 | + </ul> |
| 86 | + </li> |
| 87 | + <li><a href="?filterQuery=Commons&filterType=category">Commons</a></li> |
| 88 | + <li><a href="?filterQuery=Snippets&filterType=category">Snippets</a></li> |
| 89 | + <li><a href="?filterQuery=Blocks&filterType=category">Blocks</a></li> |
| 90 | + <li><a href="?filterQuery=Templates&filterType=category">Templates</a></li> |
| 91 | + </ul> |
81 | 92 | </div> |
82 | | - {% endfor %} |
| 93 | + |
| 94 | + {% for items in components %} |
| 95 | + <div> |
| 96 | + {% for item in items %} |
| 97 | + {% include '@TwigDoc/component/_item.html.twig' with { component: item } %} |
| 98 | + {% endfor %} |
| 99 | + </div> |
| 100 | + {% endfor %} |
| 101 | + </div> |
83 | 102 | </div> |
84 | | -</div> |
85 | 103 | {% endblock %} |
86 | 104 | </body> |
0 commit comments