mirror of
https://github.com/ZHANGTIANYAO1/teamspeak-music-bot.git
synced 2026-10-01 20:42:50 +08:00
feat(web): add SourceTabs component for platform switcher
Presentational component for switching between netease and qq music sources. Auto-hides when fewer than 2 sources are passed in. Mobile breakpoint enlarges touch target to 36px. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
4a990bfde3
commit
a216709227
1 file changed
+78
@@ -0,0 +1,78 @@
|
|||||||
|
<template>
|
||||||
|
<div v-if="sources.length >= 2" class="source-tabs">
|
||||||
|
<button
|
||||||
|
v-for="src in sources"
|
||||||
|
:key="src"
|
||||||
|
type="button"
|
||||||
|
class="source-tab"
|
||||||
|
:class="{ active: src === modelValue }"
|
||||||
|
@click="$emit('update:modelValue', src)"
|
||||||
|
>
|
||||||
|
{{ LABELS[src] }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
type Source = 'netease' | 'qq';
|
||||||
|
|
||||||
|
const LABELS: Record<Source, string> = {
|
||||||
|
netease: '网易云',
|
||||||
|
qq: 'QQ',
|
||||||
|
};
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
modelValue: Source;
|
||||||
|
sources: Source[];
|
||||||
|
}>();
|
||||||
|
|
||||||
|
defineEmits<{
|
||||||
|
'update:modelValue': [value: Source];
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.source-tabs {
|
||||||
|
display: inline-flex;
|
||||||
|
gap: 4px;
|
||||||
|
margin-left: 12px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-tab {
|
||||||
|
padding: 4px 10px;
|
||||||
|
min-height: 28px;
|
||||||
|
font-size: var(--fs-sm);
|
||||||
|
font-weight: var(--fw-medium);
|
||||||
|
color: var(--text-secondary);
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
border-radius: var(--radius-sm);
|
||||||
|
cursor: pointer;
|
||||||
|
transition: color var(--transition-fast), background var(--transition-fast);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: var(--text-primary);
|
||||||
|
background: var(--hover-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
color: var(--color-primary);
|
||||||
|
background: var(--color-primary-12);
|
||||||
|
font-weight: var(--fw-semi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.source-tabs {
|
||||||
|
margin-left: 8px;
|
||||||
|
gap: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-tab {
|
||||||
|
padding: 6px 10px;
|
||||||
|
min-height: 36px; // larger touch target on mobile
|
||||||
|
font-size: var(--fs-xs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in new issue
Block a user