Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Commit

Permalink
clear up a dom-locations.
Browse files Browse the repository at this point in the history
and updated: status-bar style.
  • Loading branch information
AtuyL committed Nov 30, 2018
1 parent 7a34320 commit 7f0681b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 24 deletions.
51 changes: 37 additions & 14 deletions app/components/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict'

import React, { Fragment } from 'react'
import { connect } from 'react-redux'

import SCREEN from '../consts/screen'

import IntroContainer from '../containers/intro'
import HeaderContainer from '../containers/header'
import TableContainer from '../containers/table'
Expand All @@ -9,17 +13,36 @@ import StatusBarContainer from '../containers/status-bar'
import InspectContainer from '../containers/inspect'
import DragDropContainer from '../containers/drag-drop'

const App = () => (
<Fragment>
<IntroContainer />
<HeaderContainer />
<TableContainer />
<Dialog.LinkContainer />
<Dialog.ConfirmContainer />
<InspectContainer />
<StatusBarContainer />
<DragDropContainer />
</Fragment>
)

export default App
const mapStateToProps = state => ({
screen: state.screen
})

const mapDispatchToProps = dispatch => ({})

export default connect(mapStateToProps, mapDispatchToProps)(function ({
screen
}) {
if (screen === SCREEN.INTRO) {
return <IntroContainer />
}
return (
<Fragment>
{/* header */}
<HeaderContainer />
{/* /header */}

{/* footer */}
<StatusBarContainer />
{/* /footer */}

{/* main */}
<TableContainer />
<InspectContainer />
{/* /main */}

<Dialog.LinkContainer />
<Dialog.ConfirmContainer />
<DragDropContainer />
</Fragment>
)
})
8 changes: 6 additions & 2 deletions app/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@ import * as Button from './button'
import Icon from './icon'

const Container = styled.header`
position: fixed;
z-index: 1;
width: 100%;
height: 2.5rem;
padding: 0.25rem 0.75rem;
-webkit-app-region: drag;
background-color: var(--color-neutral);
color: var(--color-white);
z-index: 4;
& ~ main {
margin-top: 2.5rem;
}
`

const HideLayer = styled.div`
Expand All @@ -24,7 +29,6 @@ const HideLayer = styled.div`
height: 100%;
left: 0;
top: 0;
z-index: 5;
`

const Header = ({ onShare, onMenu, onReport, menuVisible, version }) => {
Expand Down
15 changes: 9 additions & 6 deletions app/components/status-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@ import React from 'react'
import styled from 'styled-components'
import bytes from 'prettier-bytes'

const Bar = styled.div`
const StatusBar = styled.footer`
position: fixed;
z-index: 1;
left: 0;
bottom: 0;
width: 100vw;
min-width: 800px;
padding: 0.5rem 1rem 0.75rem;
background-color: var(--color-neutral-04);
color: var(--color-neutral-60);
& ~ main {
margin-bottom: 3rem;
}
`

const StatusBar = ({ up, down, show }) => {
export default function ({ up, down, show }) {
if (!show) return null

return (
<Bar id='status-bar'>
<StatusBar>
<span className='f7 mr3'>Download: {bytes(down)}/s</span>
<span className='f7'>Upload: {bytes(up)}/s</span>
</Bar>
</StatusBar>
)
}

export default StatusBar
3 changes: 1 addition & 2 deletions app/containers/status-bar.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
'use strict'

import SCREEN from '../consts/screen'
import StatusBar from '../components/status-bar'
import { connect } from 'react-redux'

const mapStateToProps = state => ({
up: state.speed.up,
down: state.speed.down,
show: state.screen === SCREEN.DATS
show: true
})

const mapDispatchToProps = dispatch => ({})
Expand Down

0 comments on commit 7f0681b

Please sign in to comment.