Skip to content

Commit

Permalink
initial (just to save the code);
Browse files Browse the repository at this point in the history
  • Loading branch information
xobotyi committed Jul 2, 2018
1 parent 68590c1 commit db5c2a8
Show file tree
Hide file tree
Showing 15 changed files with 468 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
.idea/
package-lock.json
Empty file added .npmignore
Empty file.
13 changes: 13 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Contributor Code of Conduct

As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.

We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.

Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.

This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
16 changes: 16 additions & 0 deletions examples/general/components/DefaultScrollbars/App.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions examples/general/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="handheldFriendly" content="true">
</head>

<body>
<div id="root"></div>
</body>

<script src="static/bundle.js"></script>
</html>
6 changes: 6 additions & 0 deletions examples/general/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import { render } from 'react-dom';

import DefaultScrollbarsApp from './components/DefaultScrollbars/App';

render(<DefaultScrollbarsApp />, document.getElementById('root'));
19 changes: 19 additions & 0 deletions examples/general/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
let webpack = require('webpack'),
WebpackDevServer = require('webpack-dev-server'),
webpackConfig = require('./webpack.config');

new WebpackDevServer(
webpack(webpackConfig),
{
publicPath: webpackConfig.output.publicPath,
hot: true,
stats: {
colors: true,
},
})
.listen(3000, 'localhost', function (err) {
if (err) {
console.log(err);
}
console.log('Listening at localhost:3000');
});
51 changes: 51 additions & 0 deletions examples/general/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
let path = require('path');

module.exports = {
mode: "development",
target: "web",
devtool: 'eval',
entry: ['webpack-dev-server/client?http://localhost:3000'].concat('./index'),
watch: true,
output: {
path: path.join(__dirname, 'static'),
filename: 'bundle.js',
publicPath: '/static/',
},
optimization: {
noEmitOnErrors: true,
},
resolve: {
alias: {
"react-scrollbar-custom": path.join(__dirname, '..', '..', 'src'),
},
extensions: ['.js'],
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
options: {
sourceMaps: false,
comments: false,
cacheDirectory: false,
presets: [
"stage-0",
"react",
[
"env",
{
"targets": {
"chrome": 58,
},
},
],
],
},
},
},
],
},
};
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "react-scrollbar-custom",
"description": "The best React custom scrollbars component",
"version": "0.0.1",
"repository": {
"type": "git",
"url": "https://github.com/xobotyi/react-scrollbars-custom.git"
},
"bugs": {
"url": "https://github.com/xobotyi/react-scrollbars-custom/issues"
},
"homepage": "https://github.com/xobotyi/react-scrollbars-custom",
"author": "Anton Zinovyev",
"license": "MIT",
"keywords": [
"scroll",
"scrollbar",
"scroller",
"react",
"react-component",
"custom"
],
"dependencies": {
"prop-types": "^15.6.2",
"raf": "^3.4.0"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0 || ^16.0.0",
"react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-transform-decorators-legacy": "^1.3.5",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"path": "^0.12.7",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"webpack": "^4.14.0",
"webpack-dev-server": "^3.1.4"
}
}
21 changes: 21 additions & 0 deletions src/Scrollbar/defaultElementRender.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';

export function scroller(props) {
return <div className="CustomScrollbar-view" { ...props } />;
}

export function trackVertical(props) {
return <div className="CustomScrollbar-track CustomScrollbar-trackVertical" { ...props } />;
}

export function trackHorizontal(props) {
return <div className="CustomScrollbar-track CustomScrollbar-trackHorizontal" { ...props } />;
}

export function thumbVertical(props) {
return <div className="CustomScrollbar-thumb CustomScrollbar-thumbVertical" { ...props } />;
}

export function thumbHorizontal(props) {
return <div className="CustomScrollbar-thumb CustomScrollbar-thumbHorizontal" { ...props } />;
}
43 changes: 43 additions & 0 deletions src/Scrollbar/defaultElementStyle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
export const wrapper = {
position: 'relative',
overflow: 'hidden',
};

export const scroller = {
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
right: 0,
overflow: 'scroll',
};

export const trackVertical = {
position: 'absolute',
top: 0,
right: 0,
width: 8,
height: '100%',
};

export const trackHorizontal = {
position: 'absolute',
bottom: 0,
left: 0,
width: '100%',
height: 8,
};

export const thumbVertical = {
position: 'relative',
width: '100%',
cursor: 'pointer',
background: 'rgba(0,0,0,.35)',
};

export const thumbHorizontal = {
position: 'relative',
height: '100%',
cursor: 'pointer',
background: 'rgba(0,0,0,.35)',
};
Loading

0 comments on commit db5c2a8

Please sign in to comment.