Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Carbon ads #4891

Merged
merged 28 commits into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
175f3d9
feat(docs): add carbon ads
jacobmllr95 Mar 5, 2020
5dd0f1a
Update styles.scss
jacobmllr95 Mar 5, 2020
b33cbc1
Update ad.js
jacobmllr95 Mar 6, 2020
87d7a90
Update quick-links.vue
jacobmllr95 Mar 6, 2020
d04d863
Update ad.js
jacobmllr95 Mar 6, 2020
2c6b7da
Update ad.js
jacobmllr95 Mar 6, 2020
23e7cb8
Remove ad plugin
jacobmllr95 Mar 6, 2020
11c9aa9
Move the re-positioning logic outside the individual components
jacobmllr95 Mar 6, 2020
163cc2a
Update docs.js
jacobmllr95 Mar 6, 2020
0a0cc73
Update docs-mixin.js
jacobmllr95 Mar 6, 2020
3604c2a
Merge branch 'dev' into feat-docs-add-carbon-ads
tmorehouse Mar 6, 2020
899d563
Update docs.js
tmorehouse Mar 6, 2020
21f5bfc
Update docs.js
jacobmllr95 Mar 6, 2020
8bad928
Merge branch 'feat-docs-add-carbon-ads' of https://github.com/bootstr…
jacobmllr95 Mar 6, 2020
9c97191
Update docs.js
tmorehouse Mar 6, 2020
1513fa2
Update docs.js
tmorehouse Mar 6, 2020
fe34215
Update docs.js
tmorehouse Mar 6, 2020
57d0005
Update index.vue
tmorehouse Mar 6, 2020
fece822
Update styles.scss
tmorehouse Mar 6, 2020
e705eac
Update docs.js
tmorehouse Mar 6, 2020
6be77d0
Merge branch 'dev' into feat-docs-add-carbon-ads
tmorehouse Mar 6, 2020
a54e7c2
Update styles.scss
tmorehouse Mar 6, 2020
e49927c
Update docs.js
tmorehouse Mar 6, 2020
a213db7
Update styles.scss
tmorehouse Mar 6, 2020
5d0975a
Update styles.scss
tmorehouse Mar 6, 2020
4a55d01
Update styles.scss
tmorehouse Mar 6, 2020
d9f6b7c
Update ad.js
tmorehouse Mar 6, 2020
9a309e1
Update styles.scss
tmorehouse Mar 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions docs/components/ad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export default {
name: 'BVDAd',
tmorehouse marked this conversation as resolved.
Show resolved Hide resolved
props: {
id: {
type: String,
default: '_carbonads_js'
},
url: {
type: String,
default: '//cdn.carbonads.com/carbon.js?serve=CE7ITK77&placement=bootstrap-vuejsorg'
},
positionAfter: {
type: String,
default: null
}
},
mounted() {
this.setPosition()
},
methods: {
setPosition() {
if (!this.positionAfter || typeof document === 'undefined') {
return
}
// Move the ad to the correct position, if possible
const $body = document.body
const $referenceNode = $body.querySelector(this.positionAfter)
if ($referenceNode) {
// IE 11 doesn't support the `node.after()` method, and appears
// that the polyfill doesn't polyfill this method
$referenceNode.insertAdjacentElement('afterend', this.$el)
}
}
},
render(h) {
return h('script', {
attrs: {
id: this.id,
async: 'async',
type: 'text/javascript',
src: this.url
}
})
}
}
6 changes: 4 additions & 2 deletions docs/layouts/docs.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import Ad from '~/components/ad'
import DocBreadcrumbs from '~/components/doc-breadcrumbs.vue'
import Feedback from '~/components/feedback'
import Header from '~/components/header'
import Footer from '~/components/footer'
import Search from '~/components/search'
import Header from '~/components/header'
import QuickLinks from '~/components/quick-links.vue'
import Search from '~/components/search'
import Sidebar from '~/components/sidebar.vue'
import Toc from '~/components/toc.vue'

Expand Down Expand Up @@ -41,6 +42,7 @@ export default {
h(Feedback, { class: ['float-right', 'mt-2', 'mb-0', 'mb-lg-2'] }),
h('div', { class: ['clearfix', 'd-block'] }),
h(QuickLinks, { class: 'd-xl-none' }),
h(Ad, { props: { positionAfter: '.bd-lead' } }),
tmorehouse marked this conversation as resolved.
Show resolved Hide resolved
h('nuxt')
]
)
Expand Down
7 changes: 6 additions & 1 deletion docs/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,12 @@ module.exports = {
]
},

plugins: ['~/plugins/bootstrap-vue.js', '~/plugins/play.js', '~/plugins/docs.js'],
plugins: [
'~/plugins/bootstrap-vue.js',
'~/plugins/ads.js',
'~/plugins/play.js',
'~/plugins/docs.js'
],

buildModules: ['@nuxtjs/google-analytics'],
modules: ['@nuxtjs/pwa'],
Expand Down
8 changes: 7 additions & 1 deletion docs/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@
</b-btn>
</b-col>
</b-row>

<BVAd></BVAd>
</b-container>
</section>

Expand Down Expand Up @@ -663,10 +665,14 @@ $bv-angle-padding-md: 6rem;

<script>
import { version, bootstrapVersion, vueVersion } from '~/content'
import BVAd from '~/components/ad'
import BVDContributors from '~/components/contributors'

export default {
components: { BVDContributors },
components: {
BVAd,
BVDContributors
},
data() {
return {
isIE: false,
Expand Down
4 changes: 4 additions & 0 deletions docs/plugins/ads.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import Vue from 'vue'
import BVAd from '~/components/ad'

Vue.component('BVAd', BVAd)