<script>
    export let type = "left"; 

    let rule = "";

    if (type == "left") {
        rule = "margin-left: auto";
    }
    if (type == "right") {
        rule = "margin-right: auto";
    }
    if (type == "top") {
        rule = "margin-top: auto";
    }
    if (type == "bottom") {
        rule = "margin-bottom: auto";
    }
    if (type == "vertical") {
        rule = "margin-top: auto; margin-bottom: auto";
    }
    if (type == "horizontal") {
        rule = "margin-left: auto; margin-right: auto";
    }

    if (rule == "") {
        console.error("Invalid spacer type: " + type);
    }

</script>

<div class="spacer" style="{rule}"/>