Skip to content

Commit

Permalink
playerbar
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrixer committed Dec 15, 2021
1 parent 7e48b04 commit 72b7f5c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 9 deletions.
14 changes: 12 additions & 2 deletions components/playerBar.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { Box, Flex } from '@chakra-ui/layout'
import { Box, Flex, Text } from '@chakra-ui/layout'

const PlayerBar = () => {
return <Box>hello</Box>
return (
<Box height="100px" width="100vw" bg="gray.900" padding="10px">
<Flex align="center">
<Box padding="20px" color="white" width="30%">
<Text fontSize="large">Song Name</Text>
<Text fontSize="sm">Artist Name</Text>
</Box>
<Box width="40%">controls</Box>
</Flex>
</Box>
)
}

export default PlayerBar
3 changes: 2 additions & 1 deletion components/playerLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box } from '@chakra-ui/layout'
import Sidebar from './sidebar'
import PlayerBar from './playerBar'

const PlayerLayout = ({ children }) => {
return (
Expand All @@ -11,7 +12,7 @@ const PlayerLayout = ({ children }) => {
<Box height="calc(100vh - 100px)">{children}</Box>
</Box>
<Box position="absolute" left="0" bottom="0">
player
<PlayerBar />
</Box>
</Box>
)
Expand Down
12 changes: 12 additions & 0 deletions lib/store.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { createStore, action } from 'easy-peasy'

export const store = createStore({
activeSongs: [],
activeSong: null,
changeActiveSongs: action((state: any, payload) => {
state.activeSongs = payload
}),
changeActiveSong: action((state: any, payload) => {
state.activeSong = payload
}),
})
16 changes: 10 additions & 6 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ChakraProvider, extendTheme } from '@chakra-ui/react'
import { StoreProvider } from 'easy-peasy'
import PlayerLayout from '../components/playerLayout'
import 'reset-css'
import { store } from '../lib/store'

const theme = extendTheme({
colors: {
Expand Down Expand Up @@ -33,13 +35,15 @@ const theme = extendTheme({
const MyApp = ({ Component, pageProps }) => {
return (
<ChakraProvider theme={theme}>
{Component.authPage ? (
<Component {...pageProps} />
) : (
<PlayerLayout>
<StoreProvider store={store}>
{Component.authPage ? (
<Component {...pageProps} />
</PlayerLayout>
)}
) : (
<PlayerLayout>
<Component {...pageProps} />
</PlayerLayout>
)}
</StoreProvider>
</ChakraProvider>
)
}
Expand Down

0 comments on commit 72b7f5c

Please sign in to comment.