Skip to content

Commit ac7377c

Browse files
committed
initial commit
0 parents  commit ac7377c

36 files changed

Lines changed: 2442 additions & 0 deletions

package.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"name": "bootstrap-layout",
3+
"version": "1.0.0-alpha.1",
4+
"description": "Bootstrap layout with sidebar navigation and extras.",
5+
"scripts": {
6+
"test": "echo \"Error: no test specified\" && exit 1",
7+
"dev": "webpack --config src/build/webpack.config.dev.js --progress --watch",
8+
"build": "NODE_ENV=production webpack --config src/build/webpack.config.production.js --progress",
9+
"build-dev": "webpack --config src/build/webpack.config.dev.js --progress"
10+
},
11+
"main": "dist/bootstrap-layout.js",
12+
"author": "MOSAICPRO <contact@mosaicpro.biz> (http://themeforest.net/user/mosaicpro/portfolio)",
13+
"license": "ISC",
14+
"devDependencies": {
15+
"autoprefixer": "^6.3.3",
16+
"babel-core": "^6.4.0",
17+
"babel-loader": "^6.2.1",
18+
"babel-plugin-transform-runtime": "^6.4.3",
19+
"babel-preset-es2015": "^6.3.13",
20+
"babel-runtime": "^5.8.34",
21+
"css-loader": "^0.23.0",
22+
"eslint": "^1.10.3",
23+
"eslint-loader": "^1.2.0",
24+
"extract-text-webpack-plugin": "^0.9.1",
25+
"file-loader": "^0.8.5",
26+
"node-sass": "^3.4.2",
27+
"postcss-loader": "^0.8.1",
28+
"sass-importer-npm": "^1.0.0",
29+
"sass-loader": "^3.1.2",
30+
"style-import-loader": "^0.2.0",
31+
"style-loader": "^0.13.0",
32+
"themekit-webpack-config": "^1.1.0",
33+
"url-loader": "^0.5.7",
34+
"webpack": "^1.12.11"
35+
},
36+
"dependencies": {
37+
"bootstrap": "^4.0.0-alpha.2",
38+
"breakpoints": "github:lazabogdan/breakpoints",
39+
"mout": "^0.11.1",
40+
"sass-md-colors": "^1.0.0",
41+
"simplebar": "github:grsmto/simplebar"
42+
},
43+
"keywords": [
44+
"adminplus",
45+
"bootstrap",
46+
"bootstrap4",
47+
"layout",
48+
"sidebar"
49+
]
50+
}

src/build/webpack.config.dev.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var config = require('./webpack.config')
2+
module.exports = config.dev({ devtool: 'eval' }).getConfig()

src/build/webpack.config.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
var path = require('path')
2+
var WebpackConfig = require('themekit-webpack-config')
3+
var config = new WebpackConfig()
4+
.withStandaloneEntry('bootstrap-layout')
5+
.withLibrary('BootstrapLayout')
6+
.withAlias({
7+
'bootstrap-layout': path.resolve(__dirname, '..')
8+
})
9+
.webpack({
10+
sassLoader: {
11+
importer: require('sass-importer-npm')
12+
},
13+
sassImportLoader: {
14+
base: './src/sass/_variables.scss'
15+
},
16+
externals: [{
17+
'jquery': {
18+
root: '$',
19+
commonjs2: 'jquery',
20+
commonjs: 'jquery',
21+
amd: 'jquery'
22+
}
23+
}]
24+
})
25+
.use('extract')
26+
27+
module.exports = config
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
var config = require('./webpack.config')
2+
module.exports = config.production().getConfig()

src/index.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// STYLING
2+
import './sass/style'
3+
4+
// COMPONENTS
5+
import Sidebar from './js/sidebar'
6+
import Scrollable from './js/scrollable'
7+
8+
// LIBRARY
9+
const BootstrapLayout = {
10+
Sidebar: new Sidebar(),
11+
Scrollable
12+
}
13+
14+
// EXPORT ES6
15+
export default BootstrapLayout
16+
17+
// EXPORT ES5
18+
module.exports = exports.default

src/js/scrollable.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import 'simplebar/src/simplebar'
2+
3+
export default function () {
4+
5+
$.fn.blScrollable = function () {
6+
if (!this.length) return
7+
if (this.length > 1) {
8+
this.each(function () {
9+
$(this).blScrollable()
10+
})
11+
return
12+
}
13+
14+
var el = this
15+
el.addClass('simplebar')
16+
17+
if (el.data('horizontal')) {
18+
el.addClass('horizontal')
19+
}
20+
21+
el.simplebar()
22+
el.simplebar().on('scroll', function () {
23+
var scrollable = $(this)
24+
let scrollTop = scrollable.simplebar('getScrollElement').scrollTop()
25+
$('body').trigger('scrolling.bl.scrollable', [scrollTop])
26+
clearTimeout(this.scrollTimer)
27+
this.scrollTimer = setTimeout(function () {
28+
let scrollTop = scrollable.simplebar('getScrollElement').scrollTop()
29+
$('body').trigger('end-scrolling.bl.scrollable', [scrollTop])
30+
}, 100)
31+
})
32+
el.on('scroll-to.bl.scrollable', (id) => {
33+
let toElement = document.querySelector(id)
34+
if (toElement) {
35+
el.simplebar('getScrollElement').animate({
36+
scrollTop: toElement.offsetTop
37+
})
38+
}
39+
})
40+
}
41+
42+
$('[data-scrollable]').blScrollable()
43+
}
44+
45+
module.exports = exports.default

0 commit comments

Comments
 (0)