-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathApiParam.vue
More file actions
142 lines (120 loc) · 2.37 KB
/
Copy pathApiParam.vue
File metadata and controls
142 lines (120 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<script setup>
import { ref } from "vue";
defineProps({
name: String,
type: String,
required: Boolean,
});
const isExpanded = ref(true);
</script>
<template>
<div class="api-param">
<div class="param-row" @click="isExpanded = !isExpanded">
<span class="expand-icon" :class="{ expanded: isExpanded }">
<svg width="8" height="8" viewBox="0 0 8 8">
<path
d="M2 1L6 4L2 7"
fill="none"
stroke="currentColor"
stroke-width="1.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</span>
<code class="param-name">{{ name }}</code>
<span class="param-colon">:</span>
<span v-if="required" class="param-required">required</span>
<span v-else class="param-optional">optional</span>
<span class="param-type">{{ type }}</span>
</div>
<div v-show="isExpanded" class="param-description">
<slot />
</div>
</div>
</template>
<style scoped>
.api-param {
border-bottom: 1px solid #e5e7eb;
padding: 12px 0;
}
.dark .api-param {
border-bottom-color: #2a2a2a;
}
.api-param:last-child {
border-bottom: none;
}
.param-row {
display: flex;
align-items: center;
gap: 6px;
cursor: pointer;
font-family: ui-monospace, SFMono-Regular, monospace;
font-size: 14px;
}
.param-row:hover {
opacity: 0.8;
}
.expand-icon {
color: #9ca3af;
width: 16px;
height: 16px;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.15s ease;
}
.expand-icon.expanded {
transform: rotate(90deg);
}
.param-name {
font-weight: 600;
color: #1f2937;
background: none;
padding: 0;
}
.dark .param-name {
color: #f3f4f6;
}
.param-colon {
color: #9ca3af;
}
.param-optional {
color: #9ca3af;
font-size: 13px;
font-style: italic;
}
.param-required {
color: #ef4444;
font-size: 13px;
}
.param-type {
color: #6b7280;
font-size: 13px;
}
.dark .param-type {
color: #9ca3af;
}
.param-description {
margin-top: 8px;
margin-left: 22px;
color: #4b5563;
font-size: 14px;
line-height: 1.6;
}
.dark .param-description {
color: #9ca3af;
}
.param-description :deep(p) {
margin: 0;
}
.param-description :deep(code) {
font-size: 13px;
background: #f3f4f6;
padding: 1px 4px;
border-radius: 3px;
}
.dark .param-description :deep(code) {
background: #1f1f1f;
}
</style>