Skip to content

Commit

Permalink
feat(playlist): add playlist navigation to sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
RCVZ committed May 4, 2021
1 parent 0b0b1a6 commit 1f1a5fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 20 deletions.
1 change: 1 addition & 0 deletions src/components/Root/Root.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';

import { mockWindowLocation, render } from '../../testUtils';

import '../../hooks/matchMedia.mock';
import Root from './Root';

describe('<Root />', () => {
Expand Down
10 changes: 2 additions & 8 deletions src/components/Root/Root.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import React, { FC } from 'react';
import { Route, Switch } from 'react-router-dom';

import Playlist from '../../screens/Playlist/Playlist';
import Home from '../../screens/Home/Home';

// Mock screens

const PlaylistScreen = () => {
return (
<>
<span>PlaylistScreen</span>
</>
);
};
const Settings = () => {
return (
<>
Expand All @@ -34,7 +28,7 @@ const Root: FC<Props> = ({ error }: Props) => {
return (
<Switch>
<Route path="/" component={Home} exact />
<Route path="/p/:id" component={PlaylistScreen} exact />
<Route path="/p/:id" component={Playlist} exact />
<Route path="/u" component={Settings} exact />
</Switch>
);
Expand Down
7 changes: 4 additions & 3 deletions src/components/SideBar/SideBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Fragment } from 'react';
import React, { Fragment, FC } from 'react';
import classNames from 'classnames';

import Close from '../../icons/Close';
Expand All @@ -9,9 +9,10 @@ import styles from './SideBar.module.scss';
type SideBarProps = {
isOpen: boolean;
onClose: () => void;
playlistMenuItems: JSX.Element[];
};

const SideBar: React.FC<SideBarProps> = ({ isOpen, onClose }) => {
const SideBar: FC<SideBarProps> = ({ isOpen, onClose, playlistMenuItems }) => {
return (
<Fragment>
<div
Expand All @@ -31,7 +32,7 @@ const SideBar: React.FC<SideBarProps> = ({ isOpen, onClose }) => {
</div>
<nav className={styles.group}>
<ButtonLink label="Home" to="/" />
<ButtonLink label="Test" to="/" />
{playlistMenuItems}
<hr className={styles.divider} />
<ButtonLink label="Settings" to="/" />
</nav>
Expand Down
9 changes: 0 additions & 9 deletions src/components/SideBar/__snapshots__/SideBar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,6 @@ exports[`<SideBar /> renders sideBar 1`] = `
Home
</span>
</a>
<a
aria-current="page"
class="link active"
href="/"
>
<span>
Test
</span>
</a>
<hr
class="divider"
/>
Expand Down

0 comments on commit 1f1a5fb

Please sign in to comment.