blowfish/src/App.jsx

69 lines
1.4 KiB
React
Raw Normal View History

2019-05-05 13:34:21 +02:00
import React, { PureComponent } from 'react'
2019-05-10 22:22:33 +02:00
import PropTypes from 'prop-types'
import { Router, Location } from '@reach/router'
2019-05-05 13:34:21 +02:00
import { webFrame } from 'electron'
2019-05-10 22:22:33 +02:00
import posed, { PoseGroup } from 'react-pose'
2019-05-05 13:34:21 +02:00
import AppProvider from './store/AppProvider'
import Titlebar from './components/Titlebar'
2019-05-08 01:02:02 +02:00
import Home from './screens/Home'
import Preferences from './screens/Preferences'
2019-05-06 00:10:28 +02:00
import './App.css'
2019-05-05 13:34:21 +02:00
//
// Disable zooming
//
webFrame.setVisualZoomLevelLimits(1, 1)
webFrame.setLayoutZoomLevelLimits(0, 0)
2019-05-10 22:22:33 +02:00
const Animation = posed.div({
enter: {
y: 0,
opacity: 1,
delay: 100,
transition: {
type: 'spring',
stiffness: 500,
damping: 25,
restDelta: 0.5,
restSpeed: 10
}
},
exit: {
y: 50,
opacity: 0,
transition: { duration: 150 }
}
})
const PosedRouter = ({ children }) => (
<Location>
{({ location }) => (
<PoseGroup>
<Animation key={location.key}>
<Router location={location}>{children}</Router>
</Animation>
</PoseGroup>
)}
</Location>
)
PosedRouter.propTypes = {
children: PropTypes.any.isRequired
}
2019-05-08 01:02:02 +02:00
2019-05-06 00:10:28 +02:00
export default class App extends PureComponent {
2019-05-05 13:34:21 +02:00
render() {
return (
<AppProvider>
<Titlebar />
2019-05-08 01:02:02 +02:00
<div className="app">
2019-05-10 22:22:33 +02:00
<PosedRouter>
<Home path="/" default />
<Preferences path="/preferences" />
</PosedRouter>
2019-05-05 13:34:21 +02:00
</div>
</AppProvider>
)
}
}