This repository has been archived by the owner on Jan 31, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
262 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const CHANGE = 'BANNER/CHANGE'; | ||
const INIT = 'BANNER/INIT'; | ||
|
||
export const bannerActions = { | ||
CHANGE: CHANGE, | ||
INIT: INIT | ||
} | ||
|
||
const initBanner = (payload) => ({ | ||
type: INIT, | ||
payload | ||
}); | ||
|
||
const changeBanner = (payload) => ({ | ||
type: CHANGE, | ||
payload | ||
}); | ||
|
||
export { | ||
changeBanner, | ||
initBanner, | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
.banner { | ||
width: 1200px; | ||
height: 565px; | ||
margin: 20px auto; | ||
display: flex; | ||
justify-content: space-between; | ||
|
||
& * { | ||
box-sizing: border-box; | ||
} | ||
|
||
& .list { | ||
width: 200px; | ||
background: rgba(0, 0, 0, 0.3);; | ||
display: flex; | ||
flex-direction: column; | ||
|
||
& .item { | ||
cursor: pointer; | ||
margin-bottom: 5px; | ||
overflow: hidden; | ||
padding-left: 5px; | ||
opacity: .5; | ||
|
||
& img { | ||
width: 100%; | ||
height: 113px; | ||
} | ||
|
||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
|
||
&:hover { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
&.active0 { | ||
& .item:nth-child(1) { | ||
opacity: 1; | ||
} | ||
} | ||
&.active1 { | ||
& .item:nth-child(2) { | ||
opacity: 1; | ||
} | ||
} | ||
&.active2 { | ||
& .item:nth-child(3) { | ||
opacity: 1; | ||
} | ||
} | ||
&.active3 { | ||
& .item:nth-child(4) { | ||
opacity: 1; | ||
} | ||
} | ||
&.active4 { | ||
& .item:nth-child(5) { | ||
opacity: 1; | ||
} | ||
} | ||
} | ||
|
||
|
||
& .player { | ||
max-width: 1000px; | ||
width: 100%; | ||
|
||
& section:first-child { | ||
padding: 0 !important; | ||
height: 100%; | ||
width: 100%; | ||
} | ||
} | ||
|
||
} |
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,74 @@ | ||
import React from 'react'; | ||
import { connect } from 'react-redux'; | ||
import classnames from 'classnames'; | ||
import ScreenItem from 'components/ScreenItem'; | ||
import styles from './Banner.css'; | ||
|
||
import { changeBanner } from 'actions'; | ||
|
||
|
||
|
||
class Banner extends React.Component { | ||
|
||
constructor(props) { | ||
super(props) | ||
|
||
this.changeBanner = this.changeBanner.bind(this) | ||
|
||
this.state = { | ||
active: 0, | ||
} | ||
} | ||
|
||
componentDidMount() { | ||
|
||
} | ||
|
||
componentDidUpdate() { | ||
|
||
} | ||
|
||
changeBanner(item, i) { | ||
this.props.changeBanner(item) | ||
this.setState({ | ||
active: i, | ||
}) | ||
} | ||
|
||
|
||
render() { | ||
const {items: items, index: index } = this.props.banner; | ||
let itemsHtml = []; | ||
|
||
items.forEach((item, key) => { | ||
itemsHtml.push( | ||
<section key={`${item.roomId}`} onClick={() => this.changeBanner(item, key)} className={styles.item}> | ||
<img src={item.cover} alt={item.title} title={item.title}/> | ||
</section> | ||
) | ||
}) | ||
|
||
|
||
|
||
return ( | ||
<div className={styles.banner}> | ||
<section className={styles.player}> | ||
<ScreenItem isBanner={true} item={index} screenCount={1} /> | ||
</section> | ||
<section className={classnames(styles.list, styles[`active${this.state.active}`])}> | ||
{itemsHtml} | ||
</section> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
const mapStateToProps = (state, ownProps) => ({ | ||
banner: state.banner, | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch, ownProps) => ({ | ||
changeBanner: (item) => dispatch(changeBanner(item)) | ||
}) | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(Banner); |
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,3 @@ | ||
import Banner from './Banner' | ||
|
||
export default Banner |
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.