From 7263f3b7b9818bb6001534e4394de0beb9d1dc14 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Sun, 13 Oct 2019 20:17:50 +0700 Subject: [PATCH] player bar --- src/components/bars/PlayerBar/index.tsx | 45 +++++++++++ src/components/bars/PlayerBar/styles.scss | 77 +++++++++++++++++++ src/containers/App.tsx | 33 ++++---- src/containers/main/BottomContainer/index.tsx | 15 ++++ .../main/BottomContainer/styles.scss | 30 ++++++++ 5 files changed, 186 insertions(+), 14 deletions(-) create mode 100644 src/components/bars/PlayerBar/index.tsx create mode 100644 src/components/bars/PlayerBar/styles.scss create mode 100644 src/containers/main/BottomContainer/index.tsx create mode 100644 src/containers/main/BottomContainer/styles.scss diff --git a/src/components/bars/PlayerBar/index.tsx b/src/components/bars/PlayerBar/index.tsx new file mode 100644 index 00000000..09aadcc0 --- /dev/null +++ b/src/components/bars/PlayerBar/index.tsx @@ -0,0 +1,45 @@ +import React, { FC } from 'react'; +import * as styles from './styles.scss'; +import { Icon } from '~/components/input/Icon'; +import { Filler } from '~/components/containers/Filler'; +import { PLAYER_STATES } from '~/redux/player/constants'; +import { connect } from 'react-redux'; +import pick from 'ramda/es/pick'; +import { selectPlayer } from '~/redux/player/selectors'; +import * as PLAYER_ACTIONS from '~/redux/player/actions'; + +const mapStateToProps = state => pick(['status'], selectPlayer(state)); +const mapDispatchToProps = { + playerPlay: PLAYER_ACTIONS.playerPlay, + playerPause: PLAYER_ACTIONS.playerPause, +}; + +type IProps = ReturnType & typeof mapDispatchToProps & {}; + +const PlayerBarUnconnected: FC = ({ status }) => { + if (status === PLAYER_STATES.UNSET) return null; + + return ( +
+
S
+
+
+
+ +
+ + + +
+ +
+
+
+
+ ); +}; + +export const PlayerBar = connect( + mapStateToProps, + mapDispatchToProps +)(PlayerBarUnconnected); diff --git a/src/components/bars/PlayerBar/styles.scss b/src/components/bars/PlayerBar/styles.scss new file mode 100644 index 00000000..64353447 --- /dev/null +++ b/src/components/bars/PlayerBar/styles.scss @@ -0,0 +1,77 @@ +.place { + position: relative; + height: 54px; + flex: 0 1 500px; + display: flex; + + &:hover { + .seeker { + transform: translate(0, -40px); + } + } +} + +.wrap { + display: flex; + border-radius: $radius 0 0 0; + background: $green_gradient; + align-items: center; + box-shadow: rgba(0, 0, 0, 0.3) 0 2px 5px, inset rgba(255, 255, 255, 0.3) 0 1px, + inset rgba(0, 0, 0, 0.3) 0 -1px; + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 54px; + flex-direction: column; + transform: translate(0, 0); + z-index: 3; +} + +.status { + flex: 0 0 54px; + display: flex; + flex-direction: row; + width: 100%; + position: absolute; + z-index: 1; + height: 54px; +} + +.seeker { + position: absolute; + z-index: 1; + width: 100%; + height: 54px; + left: 0; + background: transparentize($content_bg, 0); + transform: translate(0, 0); + transition: transform 0.25s; + border-radius: $radius; + box-sizing: border-box; + padding: $gap; + @include outer_shadow(); +} + +.playpause, +.close { + flex: 0 0 48px; + display: flex; + align-items: center; + justify-content: center; + cursor: pointer; + + svg { + width: 32px; + height: 32px; + fill: #222222; + stroke: none; + } +} + +.close { + svg { + width: 24px; + height: 24px; + } +} diff --git a/src/containers/App.tsx b/src/containers/App.tsx index d937a6da..1b988ac6 100644 --- a/src/containers/App.tsx +++ b/src/containers/App.tsx @@ -15,6 +15,7 @@ import { Modal } from '~/containers/dialogs/Modal'; import { selectModal } from '~/redux/modal/selectors'; import { BlurWrapper } from '~/components/containers/BlurWrapper'; import { NodeLayout } from './node/NodeLayout'; +import { BottomContainer } from '~/containers/main/BottomContainer'; const mapStateToProps = selectModal; const mapDispatchToProps = {}; @@ -23,22 +24,26 @@ type IProps = typeof mapDispatchToProps & ReturnType & { const Component: FC = ({ is_shown }) => ( - - - - +
+ + + + - - - - - - + + + + + + - - - - + + + + + + +
); diff --git a/src/containers/main/BottomContainer/index.tsx b/src/containers/main/BottomContainer/index.tsx new file mode 100644 index 00000000..86eee480 --- /dev/null +++ b/src/containers/main/BottomContainer/index.tsx @@ -0,0 +1,15 @@ +import React, { FC } from 'react'; +import * as styles from './styles.scss'; +import { PlayerBar } from '~/components/bars/PlayerBar'; + +interface IProps {} + +const BottomContainer: FC = ({}) => ( +
+
+ +
+
+); + +export { BottomContainer }; diff --git a/src/containers/main/BottomContainer/styles.scss b/src/containers/main/BottomContainer/styles.scss new file mode 100644 index 00000000..46ddf16c --- /dev/null +++ b/src/containers/main/BottomContainer/styles.scss @@ -0,0 +1,30 @@ +.wrap { + position: fixed; + transform: translateZ(0); + bottom: 0px; + pointer-events: none; + touch-action: none; + height: 54px; + display: flex; + z-index: 10; + width: 100%; + left: 0; + align-items: center; + justify-content: center; + padding: 0 $gap; + box-sizing: border-box; +} + +.content { + position: relative; + flex: 0 1 $content_width; + height: 48px; + display: flex; + align-items: center; + justify-content: flex-end; + + & > div { + pointer-events: all; + touch-action: all; + } +}