Skip to content

Commit 0db6caf

Browse files
author
Alexandre Stanislawski
committed
feat(docs): bootstrap v2 docs
1 parent c5dce5c commit 0db6caf

File tree

392 files changed

+17084
-17851
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

392 files changed

+17084
-17851
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1+
/docs/
2+
/docs-production/
13
node_modules/
24
dist/
35
dist-es5-module/
46
npm-debug.log
57
.DS_Store
8+
.happypack/

docgen/.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var join = require('path').join;
2+
3+
module.exports = {
4+
"extends": join(__dirname, "../.eslintrc.js"),
5+
"settings": {
6+
"import/resolver": {
7+
"webpack": {
8+
"config": join(__dirname, "webpack.config.babel.js")
9+
}
10+
}
11+
},
12+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
[
2+
{
3+
"name":"places.js",
4+
"url":"https://community.algolia.com/places/",
5+
"logo":"https://community.algolia.com/places/images/svg/places-illustration-65745839.svg",
6+
"backgroundColor": "#3a5395"
7+
},
8+
{
9+
"name":"wordpress",
10+
"url":"https://community.algolia.com/wordpress",
11+
"logo":"https://community.algolia.com/wordpress/img/icons/wp-icon.svg",
12+
"backgroundColor": "linear-gradient(to bottom right, #4041B2, #516ED1)"
13+
},
14+
{
15+
"name":"Autocomplete.js",
16+
"url":"https://github.com/algolia/autocomplete.js",
17+
"logo":"https://community.algolia.com/img/illus-autocomplete.svg",
18+
"backgroundColor": "#00587f"
19+
},
20+
{
21+
"name":"instantsearch.js",
22+
"url":"https://community.algolia.com/instantsearch.js/",
23+
"logo":"https://community.algolia.com/img/logo-is.svg",
24+
"backgroundColor": "#385D72"
25+
},
26+
{
27+
"name":"Helper.js",
28+
"url":"https://community.algolia.com/algoliasearch-helper-js/",
29+
"logo":"https://community.algolia.com/img/logo-helper.svg",
30+
"backgroundColor": "#FDBD57"
31+
},
32+
{
33+
"name":"magento",
34+
"url":"https://community.algolia.com/magento/",
35+
"logo":"http://res.cloudinary.com/hilnmyskv/image/upload/v1477318624/magento-icon-white.svg",
36+
"backgroundColor": "linear-gradient(to bottom right, #ed9259, #e76d22)"
37+
}
38+
]

docgen/assets/img/material-ui.gif

2.35 MB
Loading
3.91 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import Clipboard from 'clipboard';
2+
3+
export default function activateClipboard(codeSamples) {
4+
codeSamples.forEach(codeSample => {
5+
const cleanAfter = 500;
6+
let timeout;
7+
const copyToClipboard = document.createElement('span');
8+
9+
const setup = () => {
10+
clearTimeout(timeout);
11+
copyToClipboard.textContent = 'Copy to clipboard';
12+
copyToClipboard.classList.remove('clipboard-done');
13+
copyToClipboard.classList.add('clipboard');
14+
};
15+
16+
const done = () => {
17+
copyToClipboard.classList.add('clipboard-done');
18+
copyToClipboard.textContent = 'Copied!';
19+
};
20+
21+
const clipboard = new Clipboard(copyToClipboard, {
22+
text: () => codeSample.querySelector('code').textContent,
23+
});
24+
25+
setup();
26+
codeSample.querySelector('.heading').appendChild(copyToClipboard);
27+
copyToClipboard.addEventListener('mouseleave', setup, true);
28+
clipboard.on('success', () => {
29+
done();
30+
timeout = setTimeout(setup, cleanAfter);
31+
});
32+
});
33+
}

docgen/assets/js/api.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint-disable no-console */
2+
3+
console.log('api');
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import projects from '../data/community-projects.json';
2+
3+
function init() {
4+
const list = [];
5+
const target = document.querySelector('[data-inject-community]');
6+
7+
projects.forEach(e => {
8+
list.push({
9+
name: e.name,
10+
url: e.url,
11+
logo: e.logo,
12+
backgroundColor: e.backgroundColor ? e.backgroundColor : 'transparent',
13+
});
14+
});
15+
16+
list.forEach(t => {
17+
const tpl = `
18+
<div class="dropdown-item">
19+
<a href="${t.url}">
20+
<span class="item-icon" style="background: ${t.backgroundColor}">
21+
<img src="${t.logo}" />
22+
</span>
23+
<h4>${t.name}</h4>
24+
</a>
25+
</div>`;
26+
target.innerHTML += tpl;
27+
});
28+
}
29+
30+
export default init;
31+

docgen/assets/js/dropdowns.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
function dropdowns() {
2+
const openDropdown = document.querySelectorAll('[data-toggle-dropdown]');
3+
const otherDropdown = document.querySelectorAll('.simple-dropdown');
4+
5+
for (let i = 0; i < openDropdown.length; i++) {
6+
toggleDropdown(openDropdown[i]);
7+
}
8+
9+
function toggleDropdown(element) {
10+
const dropdown = element.getAttribute('data-toggle-dropdown');
11+
const theDropdown = document.getElementById(dropdown);
12+
element.addEventListener('click', () => {
13+
if (!theDropdown.classList.contains('opened')) {
14+
for (let i = 0; i < otherDropdown.length; i++) {
15+
otherDropdown[i].classList.remove('opened');
16+
}
17+
18+
theDropdown.classList.add('opened');
19+
theDropdown.setAttribute('aria-expanded', 'true');
20+
theDropdown.setAttribute('aria-expanded', 'true');
21+
} else {
22+
theDropdown.classList.remove('opened');
23+
theDropdown.setAttribute('aria-expanded', 'false');
24+
theDropdown.setAttribute('aria-expanded', 'false');
25+
}
26+
});
27+
28+
// When there is a click event
29+
// Check if the clicked element is the
30+
// dropdown toggler, if not, close the dropdown
31+
document.body.addEventListener('click', e => {
32+
if (!element.contains(e.target)) {
33+
theDropdown.classList.remove('opened');
34+
}
35+
});
36+
}
37+
}
38+
39+
export default dropdowns;

docgen/assets/js/editThisPage.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
if (document.querySelector('.documentation-container')) {
2+
const $edit = document.createElement('a');
3+
$edit.classList.add('editThisPage');
4+
$edit.textContent = 'Edit this page';
5+
6+
let href = 'https://github.com/algolia/instantsearch.js/edit/v2/';
7+
const doc = 'docgen/src';
8+
const api = 'packages/react-instantsearch/src';
9+
10+
let pathname = document.location.pathname.replace(
11+
'/instantsearch.js/react',
12+
'',
13+
);
14+
15+
if (/^\/(?:widgets|connectors)\/.+/.test(pathname)) {
16+
href += `${api}${pathname.replace('.html', '.js')}`;
17+
if (pathname === '/widgets/InstantSearch.html') {
18+
href = href.replace('/widgets/', '/core/');
19+
}
20+
} else {
21+
if (/\/$/.test(pathname)) pathname += 'index.html';
22+
href += `${doc}${pathname.replace('.html', '.md')}`;
23+
}
24+
25+
pathname = pathname.replace('.html', '.md');
26+
$edit.href = href;
27+
document.querySelector('.documentation-container').appendChild($edit);
28+
}

0 commit comments

Comments
 (0)