Skip to content

Commit facdbe6

Browse files
committed
feat: add Carbon
1 parent 23eb3aa commit facdbe6

31 files changed

+112
-1
lines changed

packages/docs/.vuepress/enhanceApp.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
77

88
import DocWrapper from './DocWrapper.vue';
99
import Inspector from './Inspector.vue';
10+
import CarbonAds from './theme/components/CarbonAds.vue'
1011
import Expo from './Expo.vue';
1112

1213
import toggleStyle from './theme/components/togglestyles.js'
@@ -18,6 +19,7 @@ export default ({
1819
library.add(fas);
1920
Vue.component('vue-fontawesome', FontAwesomeIcon);
2021

22+
Vue.component('CarbonAds', CarbonAds);
2123
Vue.component('doc-wrapper', DocWrapper);
2224
Vue.component('inspector', Inspector);
2325
Vue.component('expo', Expo);
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<script>
2+
export default {
3+
name: 'CarbonAds',
4+
watch: {
5+
'$route' (to, from) {
6+
if (
7+
to.path !== from.path
8+
// Only reload if the ad has been loaded
9+
// otherwise it's possible that the script is appended but
10+
// the ads are not loaded yet. This would result in duplicated ads.
11+
&& this.$el.querySelector('#carbonads')
12+
) {
13+
this.$el.innerHTML = ''
14+
this.load()
15+
}
16+
}
17+
},
18+
mounted () {
19+
this.load()
20+
},
21+
methods: {
22+
load () {
23+
const s = document.createElement('script')
24+
s.id = '_carbonads_js'
25+
s.src = `//cdn.carbonads.com/carbon.js?serve=CESI42JW&placement=orugaio`
26+
this.$el.appendChild(s)
27+
}
28+
},
29+
render (h) {
30+
return h('div', { class: 'carbon-ads' })
31+
}
32+
}
33+
</script>
34+
35+
<style lang="stylus">
36+
.carbon-ads
37+
align-items: center;
38+
display: flex;
39+
justify-content: center;
40+
max-width: 300px;
41+
min-height: 140px;
42+
min-width: 280px;
43+
font-size 0.75rem
44+
a
45+
color #444
46+
font-weight normal
47+
display inline
48+
.carbon-img
49+
float left
50+
margin-right 1rem
51+
border 1px solid $borderColor
52+
img
53+
display block
54+
.carbon-poweredby
55+
color #999
56+
display block
57+
margin-top 0.5em
58+
@media (max-width: $MQMobile)
59+
.carbon-ads
60+
.carbon-img img
61+
width 100px
62+
height 77px
63+
</style>

packages/docs/.vuepress/theme/components/Home.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
{{ data.tagline || $description || 'Welcome to your VuePress site' }}
2525
</p>
2626

27+
<div class="ads-centered">
28+
<CarbonAds />
29+
</div>
30+
2731
<p
2832
v-if="data.actionText && data.actionLink"
2933
class="action"
@@ -51,6 +55,7 @@
5155
v.{{pkgNext.version}}
5256
</div>
5357
</div>
58+
5459
</header>
5560

5661
<div
@@ -80,14 +85,16 @@
8085

8186
<script>
8287
import NavLink from '@theme/components/NavLink.vue'
88+
import CarbonAds from '@theme/components/CarbonAds.vue'
89+
8390
8491
import pkg from '../../../../oruga/package.json'
8592
import pkgNext from '../../../../oruga-next/package.json'
8693
8794
export default {
8895
name: 'Home',
8996
90-
components: { NavLink },
97+
components: { NavLink, CarbonAds },
9198
9299
data() {
93100
return {
@@ -112,6 +119,9 @@ export default {
112119
</script>
113120

114121
<style lang="stylus">
122+
.ads-centered
123+
display: flex
124+
justify-content: center
115125
.home
116126
padding $navbarHeight 2rem 0
117127
max-width $homePageWidth

packages/docs/components/Autocomplete.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ title: Autocomplete
324324

325325
:::
326326

327+
<CarbonAds />
327328
## Class props
328329

329330
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_autocomplete.scss)

packages/docs/components/Button.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ title: Button
154154

155155
:::
156156

157+
<CarbonAds />
157158
## Class props
158159

159160
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_button.scss)

packages/docs/components/Checkbox.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ title: Checkbox
145145

146146
:::
147147

148+
<CarbonAds />
148149
## Class props
149150

150151
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_checkbox.scss)

packages/docs/components/Collapse.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ title: Collapse
128128

129129
:::
130130

131+
<CarbonAds />
131132
## Class props
132133

133134
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_collapse.scss)

packages/docs/components/Datepicker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ title: Datepicker
361361

362362
:::
363363

364+
<CarbonAds />
364365
## Class props
365366

366367
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_datepicker.scss)

packages/docs/components/Datetimepicker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ title: Datetimepicker
136136

137137
:::
138138

139+
<CarbonAds />
139140
## Class props
140141

141142
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_datetimepicker.scss)

packages/docs/components/Dropdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ title: Dropdown
206206

207207
:::
208208

209+
<CarbonAds />
209210
## Class props
210211

211212
📄 [Full scss file](https://github.com/oruga-ui/oruga/blob/master/packages/oruga/src/scss/components/_dropdown.scss)

0 commit comments

Comments
 (0)