Browse Source

refactor SearchResultList

Yuki Takei 6 years ago
parent
commit
36509bb448
1 changed files with 8 additions and 4 deletions
  1. 8 4
      src/client/js/components/SearchPage/SearchResultList.jsx

+ 8 - 4
src/client/js/components/SearchPage/SearchResultList.jsx

@@ -15,12 +15,16 @@ class SearchResultList extends React.Component {
 
 
   render() {
   render() {
     const resultList = this.props.pages.map((page) => {
     const resultList = this.props.pages.map((page) => {
+      const showTags = (page.tags != null) && (page.tags.length > 0);
+
       return (
       return (
         <div id={page._id} key={page._id} className="search-result-page mb-5">
         <div id={page._id} key={page._id} className="search-result-page mb-5">
-          <h2><a href={page.path}>{page.path}</a></h2>
-          { page.tags.length > 0 && (
-            <span><i className="tag-icon icon-tag"></i> {page.tags.join(', ')}</span>
-          )}
+          <h2>
+            <a href={page.path}>{page.path}</a>
+            { showTags && (
+              <div className="mt-1 small"><i className="tag-icon icon-tag"></i> {page.tags.join(', ')}</div>
+            )}
+          </h2>
           <RevisionLoader
           <RevisionLoader
             growiRenderer={this.growiRenderer}
             growiRenderer={this.growiRenderer}
             pageId={page._id}
             pageId={page._id}