|
1 | 1 | {% block head %} |
2 | | -{% block stylesheets %} |
3 | | - <style> |
4 | | - {{ include('@TwigDoc/style/style.css.twig') }} |
5 | | - </style> |
6 | | -{% endblock %} |
| 2 | + {% block stylesheets %} |
| 3 | + <style> |
| 4 | + {{ include('@TwigDoc/style/style.css.twig') }} |
| 5 | + </style> |
| 6 | + {% endblock %} |
7 | 7 | <title>{% block title %}Twig Component Documentation{% endblock %}</title> |
8 | | -{% block javascripts %} |
9 | | - <script type="application/javascript"> |
10 | | - window.addEventListener('load', () => { |
11 | | - document.querySelectorAll('.twig-doc-variation h5').forEach( |
12 | | - function (element) { |
13 | | - element.addEventListener('click', function () { |
14 | | - console.log(element); |
15 | | - let variation = element.getAttribute('data-variation'); |
16 | | - element.parentNode.querySelectorAll('.twig-doc-variation-body, h5').forEach( |
17 | | - function (e) { |
18 | | - e.classList.remove('active'); |
19 | | - }); |
20 | | - element.classList.add('active'); |
21 | | - element.parentNode.querySelector(`.twig-doc-variation-body[data-variation="${variation}"]`).classList.add('active'); |
22 | | - }) |
23 | | - } |
24 | | - ) |
25 | | - const observer = new ResizeObserver((entries) => { |
26 | | - for (const entry of entries) { |
27 | | - entry.target.closest('.twig-doc-variation-body').querySelector('.twig-doc-viewport-width-value').innerText = entry.contentRect.width; |
28 | | - } |
29 | | - }) |
30 | | - document.querySelectorAll('.twig-doc-viewport').forEach((e) => { |
31 | | - observer.observe(e); |
32 | | - }) |
33 | | - }); |
34 | | - </script> |
| 8 | + {% block javascripts %} |
| 9 | + <script type="application/javascript"> |
| 10 | + window.addEventListener('load', () => { |
| 11 | + document.querySelectorAll('.twig-doc-variation h5').forEach( |
| 12 | + function (element) { |
| 13 | + element.addEventListener('click', function () { |
| 14 | + let variation = element.getAttribute('data-variation'); |
| 15 | + element.parentNode.querySelectorAll('.twig-doc-variation-body, h5').forEach( |
| 16 | + function (e) { |
| 17 | + e.classList.remove('active'); |
| 18 | + }); |
| 19 | + element.classList.add('active'); |
| 20 | + element.parentNode.querySelector(`.twig-doc-variation-body[data-variation="${variation}"]`).classList.add('active'); |
| 21 | + }) |
| 22 | + } |
| 23 | + ) |
| 24 | + const observer = new ResizeObserver((entries) => { |
| 25 | + for (const entry of entries) { |
| 26 | + entry.target.closest('.twig-doc-variation-body').querySelector('.twig-doc-viewport-width-value').innerText = entry.contentRect.width; |
| 27 | + } |
| 28 | + }) |
| 29 | + document.querySelectorAll('.twig-doc-viewport').forEach((e) => { |
| 30 | + observer.observe(e); |
| 31 | + }) |
| 32 | + }); |
| 33 | + </script> |
| 34 | + {% endblock %} |
35 | 35 | {% endblock %} |
| 36 | + |
| 37 | +{% block navigation %} |
| 38 | + <div class="twig-doc-navigation"> |
| 39 | + {% for category in getComponentCategories() %} |
| 40 | + {% if loop.first %} |
| 41 | + <ul> |
| 42 | + {% endif %} |
| 43 | + <li> |
| 44 | + <a href="{{ path('twig_doc_home', {filterQuery: category.name, filterType: 'category'}) }}">{{ category.name }}</a> |
| 45 | + {% for subCategory in getSubCategories(category.name) %} |
| 46 | + {% if loop.first %} |
| 47 | + <ul> |
| 48 | + {% endif %} |
| 49 | + <li> |
| 50 | + <a href="{{ path('twig_doc_home', {filterQuery: subCategory.name, filterType: 'subCategory'}) }}"> |
| 51 | + {{ subCategory.name }} |
| 52 | + </a> |
| 53 | + </li> |
| 54 | + {% if loop.last %} |
| 55 | + </ul> |
| 56 | + {% endif %} |
| 57 | + {% endfor %} |
| 58 | + </li> |
| 59 | + {% if loop.last %} |
| 60 | + </ul> |
| 61 | + {% endif %} |
| 62 | + {% endfor %} |
| 63 | + </div> |
36 | 64 | {% endblock %} |
37 | 65 |
|
38 | 66 | {% block body %} |
|
45 | 73 | </div> |
46 | 74 | {% endif %} |
47 | 75 | <div class="twig-doc-body"> |
48 | | - |
49 | | - <div class="navigation"> |
50 | | - <ul> |
51 | | - <li> |
52 | | - <a href="?filterQuery=Atoms&filterType=category">Atoms</a> |
53 | | - <ul> |
54 | | - <li><a href="?filterQuery=Buttons&filterType=sub_category">Buttons</a></li> |
55 | | - <li><a href="?filterQuery=Typography&filterType=sub_category">Typography</a></li> |
56 | | - </ul> |
57 | | - </li> |
58 | | - <li><a href="?filterQuery=Commons&filterType=category">Commons</a></li> |
59 | | - <li><a href="?filterQuery=Snippets&filterType=category">Snippets</a></li> |
60 | | - <li><a href="?filterQuery=Blocks&filterType=category">Blocks</a></li> |
61 | | - <li><a href="?filterQuery=Templates&filterType=category">Templates</a></li> |
62 | | - </ul> |
63 | | - </div> |
64 | | - |
65 | 76 | {% for component in components %} |
66 | 77 | {% include '@TwigDoc/component/_item.html.twig' with { component: component } %} |
67 | 78 | {% endfor %} |
|
0 commit comments