-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added combined card-accordion component #165
Conversation
{% set _id = id ?? tabler_unique_id('collapsible_') %} | ||
{% set _open = open ?? false %} | ||
{% set _id_collapse = _id ~ '_item' %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we put that on top?
(part of me want that 😄)
<div id="{{ _id }}" class="accordion accordion-flush{% block class %} {% endblock %}"> | ||
<div class="accordion-item {% block item_class %} {% endblock %}"> | ||
<div class="accordion-header" id="{{ _id }}_heading"> | ||
<button class="accordion-button {% if not _open %}collapsed{% endif %}" | ||
type="button" data-bs-toggle="collapse" data-bs-target="#{{ _id_collapse }}" | ||
aria-expanded="true"> | ||
{% block title %}{% endblock %} | ||
</button> | ||
</div> | ||
|
||
<div id="{{ _id_collapse }}" class="accordion-collapse collapse {% if _open %}show{% endif %}"> | ||
<div class="accordion-body {% block body_class %}pt-0{% endblock %}"> | ||
{% block body %}{% endblock %} | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand that the accordion
component is scary and not easy to manipulate/use.
But isn't it more "Maintainers" friendly to use it?
The less duplicate code we have to maintain, the happier we are?
Still using blocks {% set fullsize = true %}
{% extends '@Tabler/embeds/card.html.twig' %}
{% from '@Tabler/components/accordion.html.twig' import accordion %}
{% block box_class %}border-0{% endblock %}
{% block box_title %}{% endblock %}
{% set _accordionItem = {
title: block('title') ?? '',
body: block('body') ?? '',
bodyClasses: '',
options: {
open: false,
bodyExtraClass: 'border-top',
}
} | merge(accordionItem ?? {}) %}
{% set _accordionOption = {} | merge(accordionOption ?? {}) %}
{% block box_body %}
{{ accordion(
[_accordionItem],
_accordionOption
) }}
{% endblock %} Used like that: {% set item = {
options : {
open : true
}
} %}
{% embed '@theme/embeds/collapsible.html.twig' with {accordionItem : item} %}
{% block title %}File permissions{% endblock %}
{% block body %}
.....
{% endblock %}
{% endembed %} Inside the doc, for WDYT @kevinpapst? |
I'll give this a try later today ... full day of meetings. |
Small adjustments applied, to simplify passing options. {% embed '@theme/embeds/collapsible.html.twig' with { boxtype: 'danger', border: false, open: true, flush: true } %}
{% block title %}Foo{% endblock %}
{% block body %}Bar{% endblock %}
{% endembed %} Can be reviewed @cavasinf |
Description
Replaces #162
Types of changes
Checklist