Skip to content

Commit

Permalink
add query link to article page
Browse files Browse the repository at this point in the history
  • Loading branch information
GoreStarry committed Mar 28, 2018
1 parent c44853c commit 89e25c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
21 changes: 21 additions & 0 deletions pages/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { compose } from 'redux';
import Head from 'next/head';
import stringSimilarity from 'string-similarity';
import { nl2br, linkify } from '../util/text';
import { Link } from '../routes';

import app from 'components/App';
import ArticleInfo from 'components/ArticleInfo';
Expand Down Expand Up @@ -198,6 +199,20 @@ class ArticlePage extends React.Component {
linkify(article.get('text'), { props: { target: '_blank' } })
)}
</article>
<footer>
<Link
href={{
pathname: '/',
query: {
searchUserByArticleId: article.get('id'),
filter: 'all',
replyRequestCount: 1,
},
}}
>
<a className="link-auther">查看該用戶回報的所有文章</a>
</Link>
</footer>
</section>

<section
Expand Down Expand Up @@ -242,6 +257,12 @@ class ArticlePage extends React.Component {
border: 1px solid #ccc;
border-top: 0;
}
footer {
text-align: right;
}
.link-auther {
color: #5e7d8f;
}
`}</style>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ class Index extends ListPage {
);
return (
<span>
<mark>{searchedArticle ? searchedArticle.get('text') : ''}</mark>{' '}
此篇文章相同回報者的列表
<mark>{searchedArticle ? searchedArticle.get('text') : ''}</mark>{' '}
此篇相同回報者的文章列表
<style jsx>{`
mark {
text-overflow: ellipsis;
Expand Down Expand Up @@ -244,7 +244,7 @@ class Index extends ListPage {
<h3>
{searchUserByArticleId && this.renderDescriptionOfSearchedArticle()}
</h3>
{this.renderSearch()}
{!searchUserByArticleId && this.renderSearch()}
<br />
Order By:
{this.renderOrderBy()}
Expand Down

0 comments on commit 89e25c0

Please sign in to comment.