meilisearch-admin/app/components/button.hbs

37 lines
934 B
Handlebars
Raw Normal View History

2022-05-07 08:36:29 +00:00
{{#let
2022-06-08 06:07:15 +00:00
'inline-flex items-center cursor-pointer border hover:opacity-80 active:opacity-60 focus:outline-none'
2022-05-07 08:36:29 +00:00
(hash
2022-06-08 06:07:15 +00:00
primary='text-primary border-primary'
default='text-black border-gray-dark'
2022-05-07 08:36:29 +00:00
)
(hash
2022-06-08 06:07:15 +00:00
small='px-2.5 py-1.5 text-sm'
default='px-3 py-2 leading-4 text-sm'
)
as |commonClasses styleClasses sizeClasses|
2022-05-07 08:36:29 +00:00
}}
<button
disabled={{this.disabled}}
type={{this.type}}
class="{{commonClasses}}
2022-06-08 06:07:15 +00:00
{{get styleClasses (if this.isActive 'primary' this.style)}}
2022-05-07 08:36:29 +00:00
{{get sizeClasses this.size}}
{{if @group 'first:rounded-l-md last:rounded-r-md' 'rounded-md'}}"
...attributes
{{on 'click' this.handleClick}}
>
{{#if this.isPending}}
2022-08-27 15:56:39 +00:00
<Icons::Loading @spin={{true}} class="mx-1" />
2022-05-07 08:36:29 +00:00
{{else if @icon}}
<@icon class="mx-1" />
{{/if}}
{{#if this.text}}
<span class="mx-1">
{{this.text}}
</span>
{{/if}}
</button>
{{/let}}