refactor: 세그먼트 토글 SegmentedTabs 컴포넌트로 통일 (Phase 3-1)
3개 페이지(활동/프로젝트 상세/멤버)에 반복되던 .segmented 버튼 마크업을 options 기반 SegmentedTabs 로 추출(전역 .segmented 스타일은 그대로 사용). 수량(.n) 표기는 option.count 로 처리. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts" generic="T extends string">
|
||||
// 세그먼트 토글(필터/탭) 공용 컴포넌트 — 전역 .segmented 스타일을 그대로 사용.
|
||||
// options 의 count 가 있으면 라벨 뒤에 수량(.n)을 표기한다.
|
||||
interface SegOption {
|
||||
value: T
|
||||
label: string
|
||||
count?: number
|
||||
}
|
||||
defineProps<{ modelValue: T; options: SegOption[] }>()
|
||||
const emit = defineEmits<{ (e: 'update:modelValue', value: T): void }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="segmented">
|
||||
<button
|
||||
v-for="o in options"
|
||||
:key="o.value"
|
||||
type="button"
|
||||
:class="{ active: o.value === modelValue }"
|
||||
@click="emit('update:modelValue', o.value)"
|
||||
>
|
||||
{{ o.label }}<span
|
||||
v-if="o.count !== undefined"
|
||||
class="n"
|
||||
>{{ o.count }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user