Skip to content

Commit

Permalink
don't show article title in tabs, it's ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
jaesivsm committed Jun 12, 2020
1 parent c5389c8 commit 24ba70a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
5 changes: 4 additions & 1 deletion jsclient/src/features/clusterlist/components/Article.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Divider from "@material-ui/core/Divider";

import makeStyles from "./style";

function Article({ article, hidden }) {
function Article({ article, hidden, showTitle }) {
const classes = makeStyles();
let comments;
if (article.comments) {
Expand All @@ -18,6 +18,7 @@ function Article({ article, hidden }) {
}
return (
<div hidden={hidden} className={classes.article}>
<h1 hidden={!showTitle}>{article.title}</h1>
<p>
<span>Link</span>
<Link color="secondary" target="_blank"
Expand All @@ -38,10 +39,12 @@ function Article({ article, hidden }) {

Article.propTypes = {
article: PropTypes.shape({
title: PropTypes.string.isRequired,
link: PropTypes.string.isRequired,
content: PropTypes.string.isRequired,
comments: PropTypes.string,
}),
showTitle: PropTypes.bool.isRequired,
hidden: PropTypes.bool.isRequired,
};

Expand Down
22 changes: 9 additions & 13 deletions jsclient/src/features/clusterlist/components/Articles.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,18 @@ function Articles({ articles, icons, content }) {

let contentTitle, contentTab;
if (articles.length === 1 && !content) {
return <Article article={articles[0]} hidden={false} />;
return <Article article={articles[0]} />;
} else if (content) {
contentTitle = (
<Tab key="t-0"
<Tab key="t-0" label=""
className={classes.tabs}
//
icon={<img src={jarrIcon} alt={proccessedContentTitle}
title={proccessedContentTitle} />}
label={proccessedContentTitle}
value={0} aria-controls="a-0"
/>
);
contentTab = <Content content={content} hidden={0 !== currentIndex} />;
}
const isOnlyOneTitle = [...new Set(articles.map((a) => a.title))].length === 1;
return (
<>
<Tabs indicatorColor="primary" textColor="primary"
Expand All @@ -48,20 +45,19 @@ function Articles({ articles, icons, content }) {
{contentTitle}
{articles.map((article, index) => {
index = content ? index + 1 : index;
return (<Tab key={`t-${index}`}
className={classes.tabs}
icon={<ClusterIcon iconUrl={icons[article["feed_id"]]} />}
label={isOnlyOneTitle ? null : article.title}
value={index}
aria-controls={`a-${index}`}
/>);
return (<Tab key={`t-${index}`} label=""
className={classes.tabs}
icon={<ClusterIcon iconUrl={icons[article["feed_id"]]} />}
value={index}
aria-controls={`a-${index}`}
/>);
})}
</Tabs>
{contentTab}
{articles.map((article, index) => {
index = content ? index + 1 : index;
return (
<Article
<Article showTitle
key={`a-${index}-${index !== currentIndex ? "h" : ""}`}
id={`a-${index}`}
article={article}
Expand Down
1 change: 1 addition & 0 deletions jsclient/src/features/clusterlist/components/Content.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ function Content({ content, hidden }) {
}
return (
<div hidden={hidden} className={classes.article}>
<h1>Proccessed Content</h1>
{head}
{comments}
<Divider />
Expand Down

0 comments on commit 24ba70a

Please sign in to comment.