You are here

simple-styleguide.html.twig in Simple Style Guide 8

{{ attach_library('simple_styleguide/simple_styleguide.default') }}

<div class="simple-styleguide--site-styles">
    <div class="site-styles--shortcuts">

        {% if default_patterns is empty %}
          {% if custom_patterns is empty %}
            {% if default_colors is empty %}
                <p>You have not selected or created any styleguide patterns.</p>
                <p><a href="{{ url('simple_styleguide.styleguide_settings') }}" class="button">Configure Simple Styleguide</a></p>
            {% endif %}
          {% endif %}
        {% endif %}

        <div class="simple-styleguide-menu-group common">
            {% if default_patterns is defined and default_patterns is not empty %}
            <strong>Default patterns:</strong>
            <ul class="simple-styleguide--jump-nav">
                {% for default_pattern in default_patterns %}
                    <li><a href="#{{ default_pattern }}">{{ default_pattern }}</a></li>
                {% endfor %}
            </ul>
            {% endif %}

            {% if custom_patterns is defined and custom_patterns is not empty %}
            <strong>Custom patterns:</strong>
            <ul class="simple-styleguide--jump-nav">
                {% for custom_pattern in custom_patterns %}
                    <li><a href="#{{ custom_pattern.id }}">{{ custom_pattern.label|lower }}</a></li>
                {% endfor %}
            </ul>
            {% endif %}
        </div>
    </div><!-- end .shortcuts -->

    <div class="sections">
        {# -- COLORS ----------------------------------------------------------- #}
        {% if default_colors is defined and default_colors is not empty %}
            <a name="colors"></a>

            <h3 class="simple-styleguide--sectionhead">colors</h3>

            <div class="simple-styleguide">
                <div class="simple-styleguide--colors">
                {% for default_color in default_colors %}
                    <div class="simple-styleguide--color">
                        <div class="simple-styleguide--color--block {{ default_color.class }}" style="background-color: {{ default_color.hex }}"></div>
                        <div class="simple-styleguide--color--swatch">
                            <span class="simple-styleguide--color--swatch--class"><label>class:</label> {{ default_color.class }}</span>
                            <span class="simple-styleguide--color--swatch--values"><label>values:</label> {{ default_color.hex }} | rgb({{ default_color.rgb }})</span>
                            {% if default_color.description is not empty %}<span class="simple-styleguide--color--swatch--usage"><label>usage:</label> {{ default_color.description }}</span>{% endif %}
                        </div>
                    </div>
                {% endfor %}
                </div>
            </div>
        {% endif %}

        {# -- SEGMENTS ------------------------------------------------------ #}
        {% for default_pattern in default_patterns %}
            {% set pattern = '@simple_styleguide/includes/' ~ default_pattern ~ '.html.twig' %}
            {% include(pattern) %}
        {% endfor %}

        {# -- CUSTOM SEGMENTS ----------------------------------------------- #}
        {% if custom_patterns is defined and custom_patterns is not empty %}
            {% for custom_pattern in custom_patterns %}
                <a name="{{ custom_pattern.id }}"></a>
                <h3 class="simple-styleguide--sectionhead">{{ custom_pattern.label|lower }}</h3>
                <div class="simple-styleguide--pattern-description" data-pattern-id="{{ custom_pattern.id }}">{{ custom_pattern.description.value|raw }}</div>

                <div class="simple-styleguide">
                    {{ custom_pattern.template }}
                    <div class="simple-styleguide--pattern">
                        <button class="simple-styleguide--view-sourecode">View Source</button>
                        <pre>{{ custom_pattern.template|render|escape('html') }}</pre>
                    </div>
                </div>
            {% endfor %}
        {% endif %}

    </div><!-- end .sections -->
</div>

File

templates/simple-styleguide.html.twig
View source
  1. {{ attach_library('simple_styleguide/simple_styleguide.default') }}
  2. <div class="simple-styleguide--site-styles">
  3. <div class="site-styles--shortcuts">
  4. {% if default_patterns is empty %}
  5. {% if custom_patterns is empty %}
  6. {% if default_colors is empty %}
  7. <p>You have not selected or created any styleguide patterns.</p>
  8. <p><a href="{{ url('simple_styleguide.styleguide_settings') }}" class="button">Configure Simple Styleguide</a></p>
  9. {% endif %}
  10. {% endif %}
  11. {% endif %}
  12. <div class="simple-styleguide-menu-group common">
  13. {% if default_patterns is defined and default_patterns is not empty %}
  14. <strong>Default patterns:</strong>
  15. <ul class="simple-styleguide--jump-nav">
  16. {% for default_pattern in default_patterns %}
  17. <li><a href="#{{ default_pattern }}">{{ default_pattern }}</a></li>
  18. {% endfor %}
  19. </ul>
  20. {% endif %}
  21. {% if custom_patterns is defined and custom_patterns is not empty %}
  22. <strong>Custom patterns:</strong>
  23. <ul class="simple-styleguide--jump-nav">
  24. {% for custom_pattern in custom_patterns %}
  25. <li><a href="#{{ custom_pattern.id }}">{{ custom_pattern.label|lower }}</a></li>
  26. {% endfor %}
  27. </ul>
  28. {% endif %}
  29. </div>
  30. </div><!-- end .shortcuts -->
  31. <div class="sections">
  32. {# -- COLORS ----------------------------------------------------------- #}
  33. {% if default_colors is defined and default_colors is not empty %}
  34. <a name="colors"></a>
  35. <h3 class="simple-styleguide--sectionhead">colors</h3>
  36. <div class="simple-styleguide">
  37. <div class="simple-styleguide--colors">
  38. {% for default_color in default_colors %}
  39. <div class="simple-styleguide--color">
  40. <div class="simple-styleguide--color--block {{ default_color.class }}" style="background-color: {{ default_color.hex }}"></div>
  41. <div class="simple-styleguide--color--swatch">
  42. <span class="simple-styleguide--color--swatch--class"><label>class:</label> {{ default_color.class }}</span>
  43. <span class="simple-styleguide--color--swatch--values"><label>values:</label> {{ default_color.hex }} | rgb({{ default_color.rgb }})</span>
  44. {% if default_color.description is not empty %}<span class="simple-styleguide--color--swatch--usage"><label>usage:</label> {{ default_color.description }}</span>{% endif %}
  45. </div>
  46. </div>
  47. {% endfor %}
  48. </div>
  49. </div>
  50. {% endif %}
  51. {# -- SEGMENTS ------------------------------------------------------ #}
  52. {% for default_pattern in default_patterns %}
  53. {% set pattern = '@simple_styleguide/includes/' ~ default_pattern ~ '.html.twig' %}
  54. {% include(pattern) %}
  55. {% endfor %}
  56. {# -- CUSTOM SEGMENTS ----------------------------------------------- #}
  57. {% if custom_patterns is defined and custom_patterns is not empty %}
  58. {% for custom_pattern in custom_patterns %}
  59. <a name="{{ custom_pattern.id }}"></a>
  60. <h3 class="simple-styleguide--sectionhead">{{ custom_pattern.label|lower }}</h3>
  61. <div class="simple-styleguide--pattern-description" data-pattern-id="{{ custom_pattern.id }}">{{ custom_pattern.description.value|raw }}</div>
  62. <div class="simple-styleguide">
  63. {{ custom_pattern.template }}
  64. <div class="simple-styleguide--pattern">
  65. <button class="simple-styleguide--view-sourecode">View Source</button>
  66. <pre>{{ custom_pattern.template|render|escape('html') }}</pre>
  67. </div>
  68. </div>
  69. {% endfor %}
  70. {% endif %}
  71. </div><!-- end .sections -->
  72. </div>