Skip to content

Commit

Permalink
✨ Started the work to add social links
Browse files Browse the repository at this point in the history
  • Loading branch information
atapas committed Feb 28, 2022
1 parent ff71be9 commit 5f87ac7
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import Footer from './footer/Footer';
import Header from './header/Header';
import Home from './home/Home';
import Modal from './modal';
import PlayLinks from './playlinks';

export {
Header,
Footer,
Home,
PageNotFound,
Modal
Modal,
PlayLinks
};

12 changes: 12 additions & 0 deletions src/common/playlinks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { useEffect } from 'react';

const PlayLinks = ({play}) => {
console.log(play);

return(
<div className="play-links">
</div>
);
};

export default PlayLinks;
2 changes: 1 addition & 1 deletion src/common/playlists/PlayList.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const PlayList = () => {
<ul>
{plays.map((play, index) => (
<li key={play.id}>
<Link to={play.path}>{play.name}</Link>
<Link to={play.path} state={{ id: play.id }}>{play.name}</Link>
</li>
))}
</ul>
Expand Down
5 changes: 5 additions & 0 deletions src/meta/play-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const getAllPlays = () => {
return plays;
};

const getPlayById = id => {
return plays.find(play => play.id === id);
};

const getPlaysOnSearch = searchTerm => {
return plays.filter(play => {
return (play.name.toLowerCase().includes(searchTerm.toLowerCase())
Expand Down Expand Up @@ -116,6 +120,7 @@ const getAllLevels = () => {

export {
getAllPlays,
getPlayById,
getPlaysOnSearch,
getPlaysByLevel,
getPlaysByTags,
Expand Down
11 changes: 11 additions & 0 deletions src/plays/clock/CurrentTimer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@

import { useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { getPlayById } from 'meta/play-meta';
import { PlayLinks } from 'common';

const CurrentTimer = () => {
const location = useLocation();
const [play, setPlay] = useState();
const { id } = location.state;
useEffect(() => {

setPlay(getPlayById(id));
}, [id]);
// Create a real-time date time counter
const [date, setDate] = useState(new Date());

Expand All @@ -16,6 +26,7 @@ const CurrentTimer = () => {
return(

<div className="counter">
<PlayLinks play={play} />
Current Time: <h1>{date.toLocaleTimeString()}</h1>
</div>
);
Expand Down

0 comments on commit 5f87ac7

Please sign in to comment.