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

Styling and appearance improvements #45

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
43 changes: 23 additions & 20 deletions dist/customScroll.css
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
.custom-scroll {
.rcs {
min-height: 0;
min-width: 0; }
.custom-scroll .outer-container {
.rcs .rcs-outer-container {
overflow: hidden; }
.custom-scroll .outer-container .positioning {
position: relative; }
.custom-scroll .outer-container:hover .custom-scrollbar {
opacity: 1;
transition-duration: 0.2s; }
.custom-scroll .inner-container {
.rcs .rcs-outer-container .rcs-positioning {
position: absolute;
top: 0;
right: 0;
height: 100%; }
.rcs .rcs-outer-container:hover .rcs-scrollbar-hide {
opacity: 1; }
.rcs .rcs-inner-container {
overflow-x: hidden;
overflow-y: scroll; }
.custom-scroll .inner-container:after {
.rcs .rcs-inner-container:after {
content: '';
position: absolute;
top: 0;
Expand All @@ -22,33 +24,34 @@
pointer-events: none;
transition: height 0.1s ease-in;
will-change: height; }
.custom-scroll .inner-container.content-scrolled:after {
.rcs .rcs-inner-container.rcs-content-scrolled:after {
height: 5px;
transition: height 0.15s ease-out; }
.custom-scroll.scroll-handle-dragged .inner-container {
.rcs.rcs-scroll-handle-dragged .rcs-inner-container {
user-select: none; }
.custom-scroll .custom-scrollbar {
.rcs .rcs-scrollbar-hide {
transition: opacity 0.4s ease-out;
opacity: 0;
transition-duration: 0.2s; }
.rcs .rcs-custom-scrollbar {
position: absolute;
height: 100%;
width: 6px;
width: 6x;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you are missing 'p', should be 6px

right: 3px;
opacity: 0;
z-index: 1;
transition: opacity 0.4s ease-out;
padding: 6px 0;
box-sizing: border-box;
will-change: opacity;
pointer-events: none; }
.custom-scroll .custom-scrollbar.custom-scrollbar-rtl {
.rcs .rcs-custom-scrollbar.rcs-custom-scrollbar-rtl {
right: auto;
left: 3px; }
.custom-scroll.scroll-handle-dragged .custom-scrollbar {
.rcs.rcs-scroll-handle-dragged .rcs-custom-scrollbar {
opacity: 1; }
.custom-scroll .custom-scroll-handle {
.rcs .rcs-custom-scroll-handle {
position: absolute;
width: 100%;
top: 0; }
.custom-scroll .inner-handle {
.rcs .rcs-inner-handle {
height: calc(100% - 12px);
margin-top: 6px;
background-color: rgba(78, 183, 245, 0.7);
Expand Down
2 changes: 1 addition & 1 deletion dist/reactCustomScroll.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/exampleDist/example.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions example/firstComp/demoText.js

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

78 changes: 42 additions & 36 deletions example/firstComp/firstComp.js
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import React, {Component, Fragment} from 'react'
import {times, map} from 'lodash/fp'
import {demoText} from './demoText'
import CustomScroll from '../../dist/reactCustomScroll'
import React, { Component, Fragment } from 'react';
import { times, map } from 'lodash/fp';
import { demoText } from './demoText';
import CustomScroll from '../../dist/reactCustomScroll';

function getParameterByName(name) {
const url = window.location.href
name = name.replace(/[\[\]]/g, '\\$&')
const regex = new RegExp(`[?&]${ name }(=([^&#]*)|&|#|$)`)
const results = regex.exec(url)
const url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
const regex = new RegExp(`[?&]${ name }(=([^&#]*)|&|#|$)`);
const results = regex.exec(url);
if (!results) {
return null
return null;
}
if (!results[2]) {
return false
return false;
}
return decodeURIComponent(results[2].replace(/\+/g, ' '))
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

export class FirstComp extends Component {
static displayName = 'firstComp'
static displayName = 'firstComp';
constructor() {
super()
super();
this.state = {
dynamicContentCounter: 4
}
dynamicContentCounter: 4,
};
}
getText() {
return demoText.text
return demoText.text;
}
getDynamicContent() {
return times(index => `Content #${ index}`, this.state.dynamicContentCounter)
return times(index => `Content #${ index }`, this.state.dynamicContentCounter);
}
addContent = () => {
this.setState({
dynamicContentCounter: this.state.dynamicContentCounter + 1
})
dynamicContentCounter: this.state.dynamicContentCounter + 1,
});
}
removeContent = () => {
this.setState({
dynamicContentCounter: Math.max(this.state.dynamicContentCounter - 1, 4)
})
dynamicContentCounter: Math.max(this.state.dynamicContentCounter - 1, 4),
});
}
getExamplesToDisplay() {
const isFlex = getParameterByName('flex')
const isDynamic = getParameterByName('dynamic')
const isFlex = getParameterByName('flex');
const isDynamic = getParameterByName('dynamic');

return {
flex: isFlex,
dynamic: isDynamic,
standard: !isFlex && !isDynamic
}
standard: !isFlex && !isDynamic,
};
}
renderStandardExample() {
return (
Expand Down Expand Up @@ -96,10 +96,10 @@ export class FirstComp extends Component {
</div>
</div>
</Fragment>
)
);
}
render() {
const exampleTypes = this.getExamplesToDisplay()
const exampleTypes = this.getExamplesToDisplay();
return (
<div className="example-wrapper">
{exampleTypes.standard && this.renderStandardExample()}
Expand All @@ -111,7 +111,7 @@ export class FirstComp extends Component {
<div className="panel-header">
<label className="panel-title">Flexbox!!!</label>
</div>
<CustomScroll allowOuterScroll={true} flex="1">
<CustomScroll allowOuterScroll flex="1">
<div className="panel-content-custom panel-content">
<div className="content-fill">{this.getText()}</div>
</div>
Expand All @@ -127,7 +127,7 @@ export class FirstComp extends Component {
<div className="panel-header">
<label className="panel-title">DYNAMIC CONTENT!!!</label>
</div>
<CustomScroll allowOuterScroll={true} keepAtBottom={true}>
<CustomScroll allowOuterScroll keepAtBottom>
<div className="panel-content-custom panel-content">
<div className="content-fill">
{map(content => <div className="dynamic-content" key={content}>{content}</div>, this.getDynamicContent())}
Expand All @@ -136,17 +136,23 @@ export class FirstComp extends Component {
</CustomScroll>
</div>

<button className="dynamic-content-button"
key="addContent"
onClick={this.addContent}>Add Content
<button
className="dynamic-content-button"
key="addContent"
onClick={this.addContent}
>
Add Content
</button>
<button className="dynamic-content-button"
key="removeContent"
onClick={this.removeContent}>Remove Content
<button
className="dynamic-content-button"
key="removeContent"
onClick={this.removeContent}
>
Remove Content
</button>
</div>
)}
<div className="scroll-creator"/>
</div>)
</div>);
}
}
Loading