From 34fba85a609f36e824b79cb694c66fe2037c8c16 Mon Sep 17 00:00:00 2001 From: Awilum Date: Mon, 10 May 2021 16:07:16 +0300 Subject: [PATCH] feat(blocks): update block `ButtonGroup` #4 --- blocks/blocks/ButtonGroup/block.html | 106 +++++++++++++++------------ 1 file changed, 60 insertions(+), 46 deletions(-) diff --git a/blocks/blocks/ButtonGroup/block.html b/blocks/blocks/ButtonGroup/block.html index aa99a88..5e0bf45 100644 --- a/blocks/blocks/ButtonGroup/block.html +++ b/blocks/blocks/ButtonGroup/block.html @@ -1,48 +1,62 @@ -{% import "plugins/blueprints/blocks/macros/grid.html" as grid %} {% import "plugins/blueprints/blocks/macros/attr.html" as attr %} -{% if properties.layout %} -{% set btnSizes = {'large': 'btn-lg', 'small': 'btn-sm'} %} -{% set btnTypes = {'primary': 'primary', - 'secondary': 'secondary', - 'success': 'success', - 'info': 'info', - 'warning': 'warning', - 'danger': 'danger', - 'link': 'link'} %} -{% if block.properties.type %} - {% if block.properties.outline %}{% set outline = "outline-" %}{% endif %} - {% set btnType = "btn-" ~ outline ~ btnTypes[block.properties.type] %} -{% else %} - {% if block.properties.outline %}{% set outline = "outline-" %}{% endif %} - {% set btnType = "btn-" ~ outline ~ "primary" %} -{% endif %} -
- - - +{% set btnGroupSizes = {'large': 'btn-group-lg', 'small': 'btn-group-sm'} %} +{% set btnGroup = (isChildren == false and block.properties.vertical == true) ? 'btn-group-vertical' : 'btn-group' %} +
+ {% for button in block.properties.buttons %} + {% if button.type == 'ButtonGroup' %} + {% include blocks['ButtonGroup']['template'] with {'block': button, isChildren: true} %} + {% else %} + {% set btnTypes = {'primary': 'primary', + 'secondary': 'secondary', + 'success': 'success', + 'info': 'info', + 'warning': 'warning', + 'danger': 'danger', + 'link': 'link'} %} + {% if button.properties.type %} + {% if button.properties.outline %}{% set outline = "outline-" %}{% endif %} + {% set btnType = "btn-" ~ outline ~ btnTypes[button.properties.type] %} + {% else %} + {% if button.properties.outline %}{% set outline = "outline-" %}{% endif %} + {% set btnType = "btn-" ~ outline ~ "primary" %} + {% endif %} + + {% if button.properties.items and isChildren == true %} + + + {% endif %} + {% endif %} + {% endfor %}
\ No newline at end of file