-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
ApiTable.vue
111 lines (93 loc) · 2.11 KB
/
ApiTable.vue
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
<template>
<div class="api-table">
<table>
<tr>
<th v-for="heading in headings" :key="heading">{{ heading }}</th>
</tr>
<tr v-for="{ offset, name, type, description, defaults, value, example } in props" :key="name">
<td :class="{ offset }">
<span class="prop-name">{{ name }}</span>
<small class="prop-type" v-if="type">{{ type }}</small>
</td>
<td class="description" v-html="description"></td>
<td v-if="defaults || value || example">
<code v-html="defaults || value || example"></code>
</td>
</tr>
</table>
</div>
</template>
<script>
export default {
name: 'ApiTable',
props: {
props: Array,
headings: Array
}
}
</script>
<style lang="scss" scoped>
@import "~vue-material/components/MdAnimation/variables";
@import "~vue-material/theme/factory";
$bg-color: md-get-palette-color(grey, 200);
$border-color: darken($bg-color, 3%);
.api-table {
padding-bottom: 16px;
}
table {
width: 100%;
table-layout: auto;
border-collapse: collapse;
border-spacing: 0;
background-color: #fff;
font-size: 13px;
line-height: 18px;
}
tr:first-child {
background-color: $bg-color;
font-weight: 500;
}
td,
th {
padding: 8px 16px;
border: 1px solid $border-color;
color: md-get-palette-color(grey, 800);
text-align: left;
vertical-align: middle;
}
th {
height: 40px;
color: md-get-palette-color(grey, 700);
line-height: 23px;
&:first-child {
width: 22%;
}
&:nth-child(2) ~ &:last-child {
width: 17%;
}
}
td.offset {
padding-left: 32px;
}
.prop-name,
.prop-type {
display: block;
text-transform: lowercase;
}
.prop-type {
color: md-get-palette-color(grey, 600);
}
code {
color: md-get-palette-color(red, A200);
font-family: 'Roboto Mono', monospace;
>>> span {
color: md-get-palette-color(blue, A200);
}
}
.description {
>>> code {
color: md-get-palette-color(red, A200);
font-family: 'Roboto Mono', monospace;
}
}
</style>