Refactored.
This commit is contained in:
parent
665b77fb4e
commit
7825ae2727
|
@ -2,85 +2,105 @@
|
|||
|
||||
const React = require('react');
|
||||
const moment = require('moment');
|
||||
const PropTypes = require('prop-types');
|
||||
|
||||
const Layout = require('./layout.jsx');
|
||||
|
||||
class Home extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Layout>
|
||||
<ul className="scenes">
|
||||
{this.props.releases.map(release => (
|
||||
<li key={release.id} className="scene">
|
||||
<span
|
||||
className="scene-banner"
|
||||
const Home = ({ releases }) => (
|
||||
<Layout>
|
||||
<ul className="scenes">
|
||||
{releases.map(release => (
|
||||
<li key={release.id} className="scene">
|
||||
<span
|
||||
className="scene-banner"
|
||||
>
|
||||
<span className="scene-details">
|
||||
<a
|
||||
href={`/site/${release.site.id}`}
|
||||
className="scene-site site-link"
|
||||
title={release.network.name}
|
||||
>
|
||||
<span className="scene-details">
|
||||
<a
|
||||
href={`/site/${release.site.id}`}
|
||||
className="scene-site site-link"
|
||||
title={release.network.name}
|
||||
>{release.site.name}</a>
|
||||
{release.site.name}
|
||||
</a>
|
||||
|
||||
<a
|
||||
href={release.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="scene-date"
|
||||
>{moment(release.date).format('YYYY-MM-DD')}</a>
|
||||
</span>
|
||||
<a
|
||||
href={release.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="scene-date"
|
||||
>
|
||||
{moment(release.date).format('MMM D, YYYY')}
|
||||
</a>
|
||||
</span>
|
||||
|
||||
<img
|
||||
src={`/${release.site.id}/${release.id}/0.jpg`}
|
||||
className="scene-thumbnail"
|
||||
/>
|
||||
</span>
|
||||
<img
|
||||
src={`/${release.site.id}/${release.id}/0.jpg`}
|
||||
alt={release.id}
|
||||
className="scene-thumbnail"
|
||||
/>
|
||||
</span>
|
||||
|
||||
<div className="scene-info">
|
||||
<a
|
||||
href={`/item/${release.id}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="scene-row scene-link"
|
||||
><h2 className="scene-title">{release.title}</h2></a>
|
||||
<div className="scene-info">
|
||||
<a
|
||||
href={`/item/${release.id}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="scene-row scene-link"
|
||||
>
|
||||
<h2 className="scene-title">{release.title}</h2>
|
||||
</a>
|
||||
|
||||
<span className="scene-row">
|
||||
<ul className="scene-actors nolist">{release.actors.map(actor =>
|
||||
<li
|
||||
key={actor.id}
|
||||
className="scene-actor"
|
||||
<span className="scene-row">
|
||||
<ul className="scene-actors nolist">
|
||||
{release.actors.map(actor => (
|
||||
<li
|
||||
key={actor.id}
|
||||
className="scene-actor"
|
||||
>
|
||||
<a
|
||||
href={`/actor/${actor.id}`}
|
||||
className="actor-link"
|
||||
>
|
||||
<a
|
||||
href={`/actor/${actor.id}`}
|
||||
className="actor-link"
|
||||
>{actor.name}</a>
|
||||
</li>
|
||||
)}</ul>
|
||||
</span>
|
||||
{actor.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</span>
|
||||
|
||||
<span
|
||||
title={release.tags.map(tag => tag.tag).join(', ')}
|
||||
className="scene-row"
|
||||
>
|
||||
<ul className="scene-tags nolist">{release.tags.map(tag =>
|
||||
<li
|
||||
key={tag.tag}
|
||||
className="scene-tag"
|
||||
<span
|
||||
title={release.tags.map(tag => tag.tag).join(', ')}
|
||||
className="scene-row"
|
||||
>
|
||||
<ul className="scene-tags nolist">
|
||||
{release.tags.map(tag => (
|
||||
<li
|
||||
key={tag.tag}
|
||||
className="scene-tag"
|
||||
>
|
||||
<a
|
||||
href={`/tag/${tag.tag}`}
|
||||
className="tag-link"
|
||||
>
|
||||
<a
|
||||
href={`/tag/${tag.tag}`}
|
||||
className="tag-link"
|
||||
>{tag.tag}</a>
|
||||
</li>
|
||||
)}</ul>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
}
|
||||
{tag.tag}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Layout>
|
||||
);
|
||||
|
||||
Home.propTypes = {
|
||||
releases: PropTypes.arrayOf(PropTypes.object),
|
||||
};
|
||||
|
||||
Home.defaultProps = {
|
||||
releases: [],
|
||||
};
|
||||
|
||||
module.exports = Home;
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
'use strict';
|
||||
|
||||
const React = require('react');
|
||||
const PropTypes = require('prop-types');
|
||||
|
||||
class Layout extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Traxxx</title>
|
||||
const Layout = ({ children }) => (
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Porn Radar</title>
|
||||
|
||||
<link href="/css/style.css" rel="stylesheet" />
|
||||
</head>
|
||||
<link href="/css/style.css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{this.props.children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
}
|
||||
<body>
|
||||
<header>
|
||||
<h1>Porn Radar</h1>
|
||||
</header>
|
||||
|
||||
<div className="content">
|
||||
{children}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
Layout.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
};
|
||||
|
||||
module.exports = Layout;
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
"neo-blessed": "^0.2.0",
|
||||
"opn": "^5.4.0",
|
||||
"pg": "^7.9.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"react": "^16.8.6",
|
||||
"react-dom": "^16.8.6",
|
||||
"sqlite3": "^4.0.6",
|
||||
|
|
|
@ -25,12 +25,33 @@ body {
|
|||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
padding: 0 0 .5rem 0;;
|
||||
border-radius: .25rem;
|
||||
margin: .5rem;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, .5);
|
||||
overflow: hidden;
|
||||
box-shadow: 0 0 3px rgba(0, 0, 0, .25);
|
||||
}
|
||||
|
||||
.scene-banner {
|
||||
position: relative;
|
||||
margin: 0 0 .5rem 0;
|
||||
}
|
||||
|
||||
.scene-thumbnail {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
display: block;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.scene-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: 0 .5rem;
|
||||
margin: 0 0 .25rem 0;
|
||||
}
|
||||
|
||||
.scene-details {
|
||||
|
@ -41,20 +62,21 @@ body {
|
|||
position: absolute;
|
||||
}
|
||||
|
||||
.scene-thumbnail {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
background-position: center;
|
||||
background-size: cover;
|
||||
.scene-site,
|
||||
.scene-date {
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, .5);
|
||||
font-size: .8rem;
|
||||
padding: .25rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.scene-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
box-sizing: border-box;
|
||||
padding: .1rem .5rem;
|
||||
.scene-site {
|
||||
border-radius: 0 0 .25rem 0;
|
||||
}
|
||||
|
||||
.scene-date {
|
||||
border-radius: 0 0 0 .25rem;
|
||||
}
|
||||
|
||||
.scene-info {
|
||||
|
@ -75,15 +97,6 @@ body {
|
|||
line-height: 1.5rem;
|
||||
}
|
||||
|
||||
.scene-site,
|
||||
.scene-date {
|
||||
color: #fff;
|
||||
background: rgba(0, 0, 0, .5);
|
||||
font-size: .8rem;
|
||||
padding: .25rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.scene-network {
|
||||
color: #555;
|
||||
margin: 0 .25rem 0 0;
|
||||
|
|
Loading…
Reference in New Issue