Skip to content

Commit 7155625

Browse files
committed
Adds new aposcodeblock vue component
1 parent 7d5aa42 commit 7155625

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
],
99
"rules": {
1010
"at-rule-disallowed-list": ["each", "function"],
11+
"scale-unlimited/declaration-strict-value": "never",
1112
"stylus/semicolon": "always",
1213
"stylus/pythonic": "never",
1314
"stylus/declaration-colon": "always",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<figure>
3+
<slot></slot>
4+
<figcaption v-if="hasCaption">
5+
<slot name="caption"></slot>
6+
</figcaption>
7+
</figure>
8+
</template>
9+
10+
<script>
11+
export default {
12+
computed: {
13+
hasCaption() {
14+
return !!this.$slots.caption;
15+
}
16+
}
17+
};
18+
</script>
19+
20+
<style lang="stylus" scoped>
21+
figure {
22+
position: relative;
23+
margin: 0;
24+
padding: 0;
25+
}
26+
27+
figcaption {
28+
z-index: 1;
29+
position: absolute;
30+
top: 0.85em;
31+
left: 3em;
32+
width: calc(100% - 6em);
33+
color: #fff;
34+
font-family: Hack, monospace;
35+
font-size: 0.85rem;
36+
text-align: center;
37+
}
38+
</style>

0 commit comments

Comments
 (0)