-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(wallpaper): Add transition for wallpaper
- Loading branch information
1 parent
69b15bf
commit 3e26bc1
Showing
21 changed files
with
312 additions
and
272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/js/components/atoms/BackgroundWallpaper/BackgroundWallpaper.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
.wrapper { | ||
position: absolute; | ||
top: 0; | ||
width: 100%; | ||
height: 100%; | ||
} | ||
|
||
|
||
.defaultBackground { | ||
position: absolute; | ||
top: 0; | ||
z-index: 1; | ||
|
||
width: 100%; | ||
height: 100%; | ||
|
||
background-image: var(--default-background); | ||
background-repeat: no-repeat; | ||
background-size: cover; | ||
background-position: center; | ||
|
||
opacity: 1; | ||
|
||
transition: opacity 2s ease-in-out; | ||
} | ||
|
||
.backgroundSet { | ||
opacity: 0; | ||
} | ||
|
||
.background { | ||
position: absolute; | ||
top: 0; | ||
z-index: 0; | ||
|
||
width: 100%; | ||
height: 100%; | ||
|
||
background-repeat: no-repeat; | ||
background-size: cover; | ||
background-position: center; | ||
} |
23 changes: 23 additions & 0 deletions
23
src/js/components/atoms/BackgroundWallpaper/BackgroundWallpaper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import styles from './BackgroundWallpaper.module.scss'; | ||
|
||
interface Props { | ||
src?: string; | ||
} | ||
|
||
export default function BackgroundWallpaper(props: Props) { | ||
const { src } = props; | ||
const backgroundImage = src ? `url(${src})` : undefined; | ||
|
||
const defaultBackgroundClassName = classnames(styles.defaultBackground, { | ||
[styles.backgroundSet]: !!backgroundImage, | ||
}); | ||
|
||
return ( | ||
<div className={styles.wrapper}> | ||
<div className={defaultBackgroundClassName} /> | ||
<div className={styles.background} style={{ backgroundImage }} /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './BackgroundWallpaper'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import { Route } from 'react-router'; | ||
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'; | ||
import Paper from 'material-ui/Paper'; | ||
import classnames from 'classnames'; | ||
import styles from './DefaultLayout.module.scss'; | ||
import logo from '../../img/PlayOSLogoSide_white.svg'; | ||
import ChoosePage from '../pages/ChoosePage'; | ||
import LoginPage from '../pages/LoginPage'; | ||
import RegisterPage from '../pages/RegisterPage'; | ||
import HomePage from '../pages/HomePage/HomePage'; | ||
import BackgroundWallpaper from '../components/atoms/BackgroundWallpaper'; | ||
|
||
function getRoutes() { | ||
return ( | ||
<> | ||
<Route path="/os/choose" component={ChoosePage} /> | ||
<Route path="/os/login" component={LoginPage} /> | ||
<Route path="/os/register" component={RegisterPage} /> | ||
<Route path="/os/home" component={HomePage} /> | ||
</> | ||
); | ||
} | ||
|
||
interface Props { | ||
user: any; | ||
currentPathName: string; | ||
} | ||
|
||
function DefaultLayout(props: Props) { | ||
const { user, currentPathName } = props; | ||
const { wallpaper } = user.info; | ||
|
||
return ( | ||
<MuiThemeProvider> | ||
<div className={styles.defaultLayout}> | ||
<BackgroundWallpaper src={wallpaper} /> | ||
|
||
{currentPathName !== '/os/home' | ||
&& ( | ||
<section className={styles.defaultLayoutPanel}> | ||
<div className={styles.defaultLayoutPanelMessage}> | ||
<span className={styles.defaultLayoutPanelMessageLogo}> | ||
<img src={logo} alt="Logo" /> | ||
</span> | ||
</div> | ||
<Paper zDepth={5} className={styles.defaultLayoutPanelPaper}> | ||
<div className={styles.defaultLayoutPanelContent}> | ||
{getRoutes()} | ||
</div> | ||
</Paper> | ||
</section> | ||
)} | ||
|
||
{currentPathName === '/os/home' | ||
&& ( | ||
<div className={styles.childrenWrapper}> | ||
{getRoutes()} | ||
</div> | ||
)} | ||
</div> | ||
</MuiThemeProvider> | ||
); | ||
} | ||
|
||
const mapStateToProps = (store: any) => ({ | ||
SnackBarMessageStore: store.SnackBarMessageStore, | ||
user: store.UserInfoStore, | ||
currentPathName: store.router.location ? store.router.location.pathname : '', | ||
}); | ||
|
||
export default connect(mapStateToProps)(DefaultLayout); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.