hyaenidae/toolkit/templates/button.rs.html

22 lines
646 B
HTML
Raw Normal View History

2020-12-16 02:40:41 +00:00
@use crate::{Button, LinkKind};
@(button: &Button)
<div class="@button.class_string()">
<span>@button.label</span>
@if let Some(href) = button.href.as_ref() {
@match button.link_kind {
LinkKind::CurrentTab => {
<a href="@href" class="toolkit-button--action">@button.label</a>
}
LinkKind::NewTab => {
<a href="@href" target="_blank" rel="noopener noreferer" class="toolkit-button--action">
@button.label
</a>
}
}
} else {
<button class="toolkit-button--action">@button.label</button>
}
</div>