-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 55ac804 Author: Nick Beattie <nick@nickbytes.com> Date: Sun Aug 5 17:48:45 2018 -0400 refactor: refresh posts and stateless components (#12)
- Loading branch information
Showing
10 changed files
with
148 additions
and
170 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,3 @@ | ||
.DS* | ||
node_modules | ||
.DS_Store |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"url": "dat://1d5ea95a4410e14668c353c0309ca589f4f61aa51c518ccd38e89165f36d27be/", | ||
"url": | ||
"dat://aeac0a57a7f65ea03693909d817e93d8340c243137ed483076d7b68b18d09c61/", | ||
"title": "Dead", | ||
"description": "" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import React from 'react'; | ||
import ContentItem from '../ContentItem'; | ||
|
||
const ContentViewLoop = ({ posts }) => { | ||
if (posts.length > 0) { | ||
return ( | ||
<div>{posts.map((item, i) => <ContentItem vals={item} key={i} />)}</div> | ||
); | ||
} else { | ||
return <div>Sorry, no posts dipshit.</div>; | ||
} | ||
}; | ||
const ContentViewLoop = ({ posts }) => ( | ||
<div>{posts && posts.map((x, i) => <ContentItem vals={x} key={i} />)}</div> | ||
); | ||
|
||
export default ContentViewLoop; |
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 |
---|---|---|
@@ -1,71 +1,55 @@ | ||
import React from 'react'; | ||
import ContentSelection from '../ContentSelection'; | ||
|
||
class Header extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
contentSelectionOpen: false | ||
}; | ||
} | ||
const Header = ({ | ||
getPosts, | ||
contentSelectionOpen, | ||
postDisplay, | ||
togglePostDisplay, | ||
toggleContentSelection | ||
}) => ( | ||
<header className={`Header`}> | ||
<div className={`Header__Nav`}> | ||
<a | ||
className={`${'ContentToggle'} ${ | ||
contentSelectionOpen ? 'ContentToggle_Open' : '' | ||
}`} | ||
onClick={() => toggleContentSelection()} | ||
> | ||
<img src="/images/icon-plus.svg" alt="plus icon" /> | ||
</a> | ||
<div className={'ContentDisplayToggle'}> | ||
<a | ||
className={` | ||
${'ContentDisplayToggle__Item'} | ||
${postDisplay === 'mine' ? 'ContentDisplayToggle__Item_Selected' : ''} | ||
`} | ||
onClick={() => togglePostDisplay('mine')} | ||
> | ||
<img src="/images/icon-smile.svg" alt="show my posts" /> | ||
</a> | ||
<a | ||
className={` | ||
${'ContentDisplayToggle__Item'} | ||
${ | ||
postDisplay === 'theirs' | ||
? 'ContentDisplayToggle__Item_Selected' | ||
: '' | ||
} | ||
`} | ||
onClick={() => togglePostDisplay('theirs')} | ||
> | ||
<img src="/images/icon-group.svg" alt="show their posts" /> | ||
</a> | ||
</div> | ||
</div> | ||
|
||
componentDidMount() {} | ||
|
||
toggleContentSelection = () => { | ||
this.setState({ | ||
contentSelectionOpen: !this.state.contentSelectionOpen | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<header className={`Header`}> | ||
<div className={`Header__Nav`}> | ||
<a | ||
className={`${'ContentToggle'} ${ | ||
this.state.contentSelectionOpen ? 'ContentToggle_Open' : '' | ||
}`} | ||
onClick={() => this.toggleContentSelection()} | ||
> | ||
<img src="/images/icon-plus.svg" alt="plus icon" /> | ||
</a> | ||
<div className={'ContentDisplayToggle'}> | ||
<a | ||
className={` | ||
${'ContentDisplayToggle__Item'} | ||
${ | ||
this.props.postDisplay === 'mine' | ||
? 'ContentDisplayToggle__Item_Selected' | ||
: '' | ||
} | ||
`} | ||
onClick={() => this.props.togglePostDisplay('mine')} | ||
> | ||
<img src="/images/icon-smile.svg" alt="show my posts" /> | ||
</a> | ||
<a | ||
className={` | ||
${'ContentDisplayToggle__Item'} | ||
${ | ||
this.props.postDisplay === 'theirs' | ||
? 'ContentDisplayToggle__Item_Selected' | ||
: '' | ||
} | ||
`} | ||
onClick={() => this.props.togglePostDisplay('theirs')} | ||
> | ||
<img src="/images/icon-group.svg" alt="show their posts" /> | ||
</a> | ||
</div> | ||
</div> | ||
<ContentSelection | ||
getPosts={this.props.getPosts} | ||
open={this.state.contentSelectionOpen} | ||
toggleContentSelection={this.toggleContentSelection} | ||
/> | ||
</header> | ||
); | ||
} | ||
} | ||
<ContentSelection | ||
getPosts={getPosts} | ||
open={contentSelectionOpen} | ||
toggleContentSelection={toggleContentSelection} | ||
/> | ||
</header> | ||
); | ||
|
||
export default Header; |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export const DAT_URL = | ||
'1d5ea95a4410e14668c353c0309ca589f4f61aa51c518ccd38e89165f36d27be'; | ||
'aeac0a57a7f65ea03693909d817e93d8340c243137ed483076d7b68b18d09c61'; |
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,10 @@ | ||
import { DAT_URL } from '../config'; | ||
const urlEnv = () => { | ||
if (process.env.NODE_ENV === 'development') { | ||
return DAT_URL; | ||
} else { | ||
return window.location.toString(); | ||
} | ||
}; | ||
|
||
export default urlEnv; |