2021-05-06 20:29:55 +02:00
|
|
|
<!--
|
|
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
-->
|
2021-10-26 00:43:02 +02:00
|
|
|
<script lang="ts">
|
2022-01-24 02:43:09 +01:00
|
|
|
import ButtonGroup from "../../components/ButtonGroup.svelte";
|
2021-05-06 20:29:55 +02:00
|
|
|
|
|
|
|
export let buttons: string[];
|
2022-02-03 05:52:11 +01:00
|
|
|
|
|
|
|
const radius = "5px";
|
|
|
|
function getBorderRadius(index: number, length: number): string {
|
|
|
|
if (index === 0 && length === 1) {
|
|
|
|
return `--border-left-radius: ${radius}; --border-right-radius: ${radius}; `;
|
|
|
|
} else if (index === 0) {
|
|
|
|
return `--border-left-radius: ${radius}; --border-right-radius: 0; `;
|
|
|
|
} else if (index === length - 1) {
|
|
|
|
return `--border-left-radius: 0; --border-right-radius: ${radius}; `;
|
|
|
|
} else {
|
|
|
|
return "--border-left-radius: 0; --border-right-radius: 0; ";
|
|
|
|
}
|
|
|
|
}
|
2021-05-06 20:29:55 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<ButtonGroup>
|
2022-02-03 05:52:11 +01:00
|
|
|
{#each buttons as button, index}
|
|
|
|
<div style={getBorderRadius(index, buttons.length)}>
|
2021-05-06 20:29:55 +02:00
|
|
|
{@html button}
|
2022-02-03 05:52:11 +01:00
|
|
|
</div>
|
2021-05-06 20:29:55 +02:00
|
|
|
{/each}
|
|
|
|
</ButtonGroup>
|
2022-02-03 05:52:11 +01:00
|
|
|
|
|
|
|
<style lang="scss">
|
|
|
|
div {
|
|
|
|
display: contents;
|
|
|
|
}
|
|
|
|
</style>
|