Closed amrutadotorg closed 1 month ago
It's currently not possible, but we could add an after_icon
parameter to the button component: would you be interested in making a small pull request to https://github.com/lovasoa/SQLpage/blob/main/sqlpage/templates/button.handlebars ?
I have no idea how to add the parameter, but asked AI. I hope It helps :)
<div class="btn-list mb-2 {{#if justify}}justify-content-{{justify}}{{/if}} {{class}}">
{{#each_row}}
{{#if form}}
<button type="submit" form="{{form}}" {{#if link}}formaction="{{link}}"{{/if}}
{{else}}
<a href="{{link}}"
{{/if}}
class="btn {{#if disabled}} disabled{{/if}}
{{~#if color}} btn-{{color}}{{/if}}
{{~#if ../size}} btn-{{../size}}{{/if}}
{{~#if outline}} btn-outline-{{outline}}{{/if}}
{{~#if ../shape}} btn-{{../shape}}{{/if}}
{{~#if space_after}} me-auto{{/if}}"
{{~#if id}} id="{{id}}"{{/if}}
role="button">
{{~#if icon~}}
<span class="me-1">{{~icon_img icon~}}</span>
{{~/if~}}
{{~title~}}
{{~#if after_icon~}}
<span class="ms-1">{{~icon_img after_icon~}}</span>
{{~/if}}
{{#if form}}
</button>
{{else}}
</a>
{{/if}}
{{/each_row}}
</div>
Explanation
{{#if icon}}:
This block checks if the icon parameter is provided. If it is, it renders the icon before the text.
{{title}}:
This renders the button text.
{{#if after_icon}}:
This new block checks if the after_icon parameter is provided. If it is, it renders the icon after the text.
In this way, the template will support both an icon before and after the text, depending on which parameters (icon or after_icon) are provided.
now looks superb, thank you
thank you