Skip to content

Commit 530668c

Browse files
committed
Chore: Add carbon
1 parent 305a1a4 commit 530668c

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

example/components/CarbonAd.vue

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<script>
2+
export default {
3+
watch: {
4+
$route (to, from) {
5+
if (
6+
to.path !== from.path &&
7+
this.$el.querySelector('#carbonads')
8+
) {
9+
this.$el.innerHTML = ''
10+
this.load()
11+
}
12+
}
13+
},
14+
mounted () {
15+
this.load()
16+
},
17+
methods: {
18+
load () {
19+
const s = document.createElement('script')
20+
s.id = '_carbonads_js'
21+
s.src = `//cdn.carbonads.com/carbon.js?serve=CK7DEK7I&placement=antonreshetovgithubio`
22+
this.$el.appendChild(s)
23+
}
24+
},
25+
render (h) {
26+
return h('div', { class: 'carbon' })
27+
}
28+
}
29+
</script>
30+
31+
<style lang="scss">
32+
.carbon {
33+
position: absolute;
34+
min-height: 250px;
35+
max-width: 180px;
36+
font-size: 0.9rem;
37+
line-height: 1.4em;
38+
padding-bottom: 10px;
39+
a {
40+
color: #444!important;
41+
font-weight: normal;
42+
text-decoration: none;
43+
}
44+
.carbon-img {
45+
img {
46+
display: block;
47+
margin: 10px 0;
48+
border: 1px solid #ddd;
49+
}
50+
}
51+
.carbon-text {
52+
// width: 130px;
53+
display: block;
54+
}
55+
.carbon-poweredby {
56+
color: #999;
57+
display: block !important;
58+
margin-top: 0.5em;
59+
}
60+
&:after {
61+
content: '';
62+
display: table;
63+
clear: both;
64+
}
65+
}
66+
</style>

example/views/Page.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</div>
1010
</div>
1111
<div class="sidebar">
12+
<carbon-ad/>
1213
<nav class="nav">
1314
<div class="nav__category">Development</div>
1415
<div
@@ -38,10 +39,15 @@ import axios from 'axios'
3839
import hljs from 'highlight.js'
3940
import 'highlight.js/styles/color-brewer.css'
4041
import nav from '../navigation'
42+
import CarbonAd from '../components/CarbonAd'
4143
4244
export default {
4345
name: 'Page',
4446
47+
components: {
48+
CarbonAd
49+
},
50+
4551
data () {
4652
return {
4753
html: '',
@@ -175,7 +181,7 @@ export default {
175181
grid-area: sidebar;
176182
padding-left: 50px;
177183
.nav {
178-
margin-top: 25px;
184+
margin-top: 220px;
179185
&__category {
180186
margin-bottom: 15px;
181187
font-size: 16px;

0 commit comments

Comments
 (0)