Scroll container component

This commit is contained in:
Lukas Martinelli 2016-12-17 20:19:01 +01:00
parent b9d3886b50
commit 4a8520c36d
3 changed files with 32 additions and 15 deletions

View file

@ -17,6 +17,8 @@ import MdVisibilityOff from 'react-icons/lib/md/visibility-off'
import MdDelete from 'react-icons/lib/md/delete' import MdDelete from 'react-icons/lib/md/delete'
import PureRenderMixin from 'react-addons-pure-render-mixin'; import PureRenderMixin from 'react-addons-pure-render-mixin';
import ScrollContainer from '../scrollcontainer.jsx'
class UnsupportedLayer extends React.Component { class UnsupportedLayer extends React.Component {
render() { render() {
return <div></div> return <div></div>
@ -141,9 +143,11 @@ export class LayerEditor extends React.Component {
<MdDelete /> <MdDelete />
</NavItem> </NavItem>
</Toolbar> </Toolbar>
<ScrollContainer>
<div style={{padding: theme.scale[2], paddingRight: 0, backgroundColor: theme.colors.black}}> <div style={{padding: theme.scale[2], paddingRight: 0, backgroundColor: theme.colors.black}}>
{this.layerFromType(this.props.layer.get('type'))} {this.layerFromType(this.props.layer.get('type'))}
</div> </div>
</ScrollContainer>
</div> </div>
} }
} }

View file

@ -8,9 +8,9 @@ import Space from 'rebass/dist/Space'
import { LayerEditor } from './editor.jsx' import { LayerEditor } from './editor.jsx'
import LayerListItem from './listitem.jsx' import LayerListItem from './listitem.jsx'
import scrollbars from '../scrollbars.scss'
import PureRenderMixin from 'react-addons-pure-render-mixin'; import PureRenderMixin from 'react-addons-pure-render-mixin';
import theme from '../theme.js' import theme from '../theme.js'
import ScrollContainer from '../scrollcontainer.jsx'
import {SortableContainer, SortableHandle, arrayMove} from 'react-sortable-hoc'; import {SortableContainer, SortableHandle, arrayMove} from 'react-sortable-hoc';
@ -53,17 +53,11 @@ class LayerListContainer extends React.Component {
onLayerSelected={this.props.onLayerSelected} onLayerSelected={this.props.onLayerSelected}
/> />
}) })
return <ul className={scrollbars.darkScrollbar} style={{ return <ScrollContainer>
overflowY: "scroll", <ul style={{ padding: theme.scale[2] }}>
bottom:0,
left:0,
right:0,
top:1,
position: "absolute",
padding: theme.scale[2],
}}>
{layerPanels} {layerPanels}
</ul> </ul>
</ScrollContainer>
} }
} }

19
src/scrollcontainer.jsx Normal file
View file

@ -0,0 +1,19 @@
import React from 'react'
import theme from './theme.js'
import scrollbars from './scrollbars.scss'
const ScrollContainer = (props) => {
return <div className={scrollbars.darkScrollbar} style={{
overflowY: "scroll",
bottom:0,
left:0,
right:0,
top:1,
position: "absolute",
padding: theme.scale[2],
}}>
{props.children}
</div>
}
export default ScrollContainer