update it
This commit is contained in:
parent
a5b4ee79d1
commit
269c20c8c6
|
@ -13,10 +13,20 @@ import Session from '../lib/session';
|
||||||
|
|
||||||
const BodyContainer = styled.div`
|
const BodyContainer = styled.div`
|
||||||
display: flex;
|
display: flex;
|
||||||
|
${media.mobile`
|
||||||
|
display: block;
|
||||||
|
`}
|
||||||
height: calc(100vh - 4rem);
|
height: calc(100vh - 4rem);
|
||||||
`
|
`
|
||||||
const ContentContainer = styled.div`
|
const ContentContainer = styled.div`
|
||||||
flex: 1;
|
flex: 1;
|
||||||
|
${media.mobile`
|
||||||
|
position: absolute;
|
||||||
|
top: 4rem;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
z-index: -1;
|
||||||
|
`}
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
@ -37,7 +47,9 @@ const HelloWorld = styled.div`
|
||||||
|
|
||||||
class App extends Component {
|
class App extends Component {
|
||||||
state = {
|
state = {
|
||||||
sidebar: true,
|
sidebar: {
|
||||||
|
toggled: false
|
||||||
|
},
|
||||||
error: {
|
error: {
|
||||||
status: false,
|
status: false,
|
||||||
message: ''
|
message: ''
|
||||||
|
@ -46,7 +58,10 @@ class App extends Component {
|
||||||
|
|
||||||
onToogleSidebar = (e) => {
|
onToogleSidebar = (e) => {
|
||||||
this.setState({
|
this.setState({
|
||||||
sidebar: !this.state.sidebar
|
sidebar: {
|
||||||
|
...this.state.sidebar,
|
||||||
|
toggled: !this.state.sidebar.toggled
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,19 +69,15 @@ class App extends Component {
|
||||||
const title = 'Next, EPC ' + Package.version;
|
const title = 'Next, EPC ' + Package.version;
|
||||||
const session = this.props.session;
|
const session = this.props.session;
|
||||||
|
|
||||||
const {
|
|
||||||
onToogleSidebar,
|
|
||||||
} = this;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{title}</title>
|
<title>{title}</title>
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<Header onToggleMenuIcon={onToogleSidebar}/>
|
<Header onMenuClick={this.onToogleSidebar}/>
|
||||||
<BodyContainer>
|
<BodyContainer>
|
||||||
<Sidebar visible={this.state.sidebar}/>
|
<Sidebar toggled={this.state.sidebar.toggled}/>
|
||||||
<ContentContainer>
|
<ContentContainer>
|
||||||
<HelloWorld>
|
<HelloWorld>
|
||||||
Hello, World
|
Hello, World
|
||||||
|
|
|
@ -36,7 +36,7 @@ const Title = styled.div`
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Thumbnail = styled.div`
|
const Thumbnail = styled.div`
|
||||||
display: flext;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-top: 1rem;
|
padding-top: 1rem;
|
||||||
padding-bottom: 1rem;
|
padding-bottom: 1rem;
|
||||||
|
@ -55,13 +55,9 @@ async function logout (e) {
|
||||||
|
|
||||||
class Header extends Component {
|
class Header extends Component {
|
||||||
render() {
|
render() {
|
||||||
const {
|
|
||||||
handleTest
|
|
||||||
} = this;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<Menu onClick={this.props.onToggleMenuIcon}>
|
<Menu onClick={this.props.onMenuClick}>
|
||||||
<MenuIcon/>
|
<MenuIcon/>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Title>
|
<Title>
|
||||||
|
|
|
@ -73,7 +73,7 @@ const ErrorBar = ({ visible, message, onClick }) => visible ? (
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
ErrorBar.propTypes = {
|
ErrorBar.propTypes = {
|
||||||
visible: PropTypes.boolean,
|
visible: PropTypes.bool,
|
||||||
message: PropTypes.string,
|
message: PropTypes.string,
|
||||||
onClick: PropTypes.func
|
onClick: PropTypes.func
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,24 +6,32 @@ import oc from 'open-color';
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
width: ${p => p.visible ? p.width : '0'};
|
width: ${p => p.toggled ? '0' : p.width };
|
||||||
transition: width .2s ease-in-out;
|
transition: width .2s ease-in-out;
|
||||||
|
|
||||||
|
${media.mobile`
|
||||||
|
width: 100%;
|
||||||
|
height: ${p => p.toggled ? '100%' : '0'};
|
||||||
|
transition: height .2s ease-in-out;
|
||||||
|
`}
|
||||||
|
|
||||||
background-color: ${oc.indigo[3]};
|
background-color: ${oc.indigo[3]};
|
||||||
border-right: 1px solid ${oc.indigo[4]};
|
border-right: 1px solid ${oc.indigo[4]};
|
||||||
box-shadow: 3px 3px 6px rgba(0,0,0,0.10), 3px 3px 6px rgba(0,0,0,0.20);
|
box-shadow: 3px 3px 6px rgba(0,0,0,0.10), 3px 3px 6px rgba(0,0,0,0.20);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const Sidebar = ({ visible, width }) =>
|
const Sidebar = ({ toggled, width }) => (
|
||||||
(<Wrapper visible={visible} width={width}> </Wrapper>)
|
<Wrapper toggled={toggled} width={width}>
|
||||||
|
</Wrapper>
|
||||||
|
)
|
||||||
|
|
||||||
Sidebar.propTypes = {
|
Sidebar.propTypes = {
|
||||||
visible: PropTypes.bool,
|
toggled: PropTypes.bool,
|
||||||
width: PropTypes.string
|
width: PropTypes.string
|
||||||
};
|
};
|
||||||
|
|
||||||
Sidebar.defaultProps = {
|
Sidebar.defaultProps = {
|
||||||
visible: true,
|
toggled: false,
|
||||||
width: '16rem'
|
width: '16rem'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue