77 lines
1.3 KiB
Vue
77 lines
1.3 KiB
Vue
<script setup lang="ts">
|
|||
|
|
withDefaults(
|
||
|
|
defineProps<{
|
||
|
|
variant?: 'primary' | 'ghost' | 'dashed' | 'icon';
|
||
|
|
type?: 'button' | 'submit';
|
||
|
|
disabled?: boolean;
|
||
|
|
block?: boolean;
|
||
|
|
}>(),
|
||
|
|
{ variant: 'primary', type: 'button' },
|
||
|
|
);
|
||
|
|
</script>
|
||
|
|
|
||
|
|
<template>
|
||
|
|
<button
|
||
|
|
:type="type"
|
||
|
|
class="ui-btn"
|
||
|
|
:class="[variant, { block }]"
|
||
|
|
:disabled="disabled"
|
||
|
|
>
|
||
|
|
<slot />
|
||
|
|
</button>
|
||
|
|
</template>
|
||
|
|
|
||
|
|
<style scoped>
|
||
|
|
.ui-btn {
|
||
|
|
display: inline-flex;
|
||
|
|
align-items: center;
|
||
|
|
justify-content: center;
|
||
|
|
gap: 0.35rem;
|
||
|
|
min-height: var(--control-h);
|
||
|
|
padding: 0 0.95rem;
|
||
|
|
border: 1px solid transparent;
|
||
|
|
border-radius: var(--radius);
|
||
|
|
background: var(--accent);
|
||
|
|
color: #fff;
|
||
|
|
font: inherit;
|
||
|
|
font-weight: 700;
|
||
|
|
font-size: 0.88rem;
|
||
|
|
white-space: nowrap;
|
||
|
|
cursor: pointer;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn:disabled {
|
||
|
|
opacity: 0.55;
|
||
|
|
cursor: not-allowed;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn.block {
|
||
|
|
width: 100%;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn.ghost {
|
||
|
|
background: #fff;
|
||
|
|
color: var(--ink);
|
||
|
|
border-color: var(--line);
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn.dashed {
|
||
|
|
background: #fff;
|
||
|
|
border: 1.5px dashed currentColor;
|
||
|
|
font-weight: 700;
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn.icon {
|
||
|
|
width: var(--control-h);
|
||
|
|
padding: 0;
|
||
|
|
background: #fff;
|
||
|
|
color: var(--accent-deep);
|
||
|
|
border-color: var(--accent);
|
||
|
|
}
|
||
|
|
|
||
|
|
.ui-btn:focus-visible {
|
||
|
|
outline: 2px solid var(--accent-soft);
|
||
|
|
outline-offset: 1px;
|
||
|
|
}
|
||
|
|
</style>
|