Files

118 lines
2.5 KiB
Vue

<template>
<button
class="app-button"
:class="[
`app-button--${type}`,
{
'app-button--block': block,
'app-button--compact': compact,
'app-button--disabled': disabled,
},
]"
:disabled="disabled"
:aria-label="label"
:hover-class="disabled ? 'none' : 'app-button--pressed'"
@click="handleClick"
>
<image class="app-button__skin" :src="skin" mode="aspectFit" />
<text class="app-button__label app-single-line"
><slot>{{ label }}</slot></text
>
</button>
</template>
<script setup>
import { computed } from "vue";
const props = defineProps({
label: { type: String, default: "" },
type: { type: String, default: "primary" },
block: { type: Boolean, default: false },
compact: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
});
const emit = defineEmits(["click"]);
const skin = computed(() =>
props.type === "secondary"
? "/static/assets/foundation/transparent/scroll-secondary.png"
: "/static/assets/foundation/transparent/scroll-primary.png",
);
const handleClick = (event) => {
if (!props.disabled) emit("click", event);
};
</script>
<style scoped lang="scss">
@use "../styles/adaptive-frame-profiles.scss" as adaptive;
.app-button {
display: inline-grid;
width: 420rpx;
max-width: 100%;
min-height: 88rpx;
place-items: center;
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
background: transparent;
line-height: normal;
}
.app-button::after {
border: 0;
}
.app-button--block {
display: grid;
width: 100%;
}
.app-button--compact {
}
.app-button--compact.app-button--primary {
@include adaptive.adaptive-scroll-button(primary);
}
.app-button--compact.app-button--secondary {
@include adaptive.adaptive-scroll-button(secondary);
}
.app-button--compact .app-button__skin {
display: none;
}
.app-button--compact .app-button__label {
padding: 0;
font-size: clamp(14px, 23rpx, 17px);
letter-spacing: 0;
white-space: nowrap;
}
.app-button__skin {
width: 100%;
height: 100%;
pointer-events: none;
}
.app-button__skin,
.app-button__label {
grid-area: 1 / 1;
}
.app-button__label {
z-index: 1;
padding: 12rpx 38rpx;
box-sizing: border-box;
color: #fffaf0;
font-size: clamp(16px, 29rpx, 20px);
font-weight: 700;
letter-spacing: 3rpx;
line-height: 1.35;
text-align: center;
}
.app-button--secondary .app-button__label {
color: #5c4330;
}
.app-button--disabled {
opacity: 0.48;
}
.app-button--pressed {
opacity: 0.78;
transform: translateY(1rpx);
}
</style>