{% set attr_class = segment.attributes.class ? ' class="' ~ segment.attributes.class|e ~ '"' %}
{% set attr_extra = segment.attributes.extra|attribute_array %}

{% set offcanvas %}
    {% for child in segment.children %}
        {% include '@nucleus/layout/' ~ child.type ~ '.html.twig' with { 'segments': child.children } %}
    {% endfor %}
{% endset %}

{%- if segment.attributes.sticky or offcanvas|trim -%}
<div id="g-offcanvas" {{ attr_class|raw }} {{- attr_extra|raw }} data-g-offcanvas-swipe="{{ segment.attributes.swipe|default('1') }}" data-g-offcanvas-css3="{{ segment.attributes.css3animation|default('1') }}">
    {{ offcanvas|raw -}}
</div>
{% endif %}
