Skip to content

Commit

Permalink
Updated ui for doc & docx file formats
Browse files Browse the repository at this point in the history
  • Loading branch information
zotya committed Feb 13, 2023
1 parent a461f6b commit a24f11c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
22 changes: 17 additions & 5 deletions searchlib/components/Result/ContentClusters.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ const ContentClusters = ({ clusters, item }) => {
const format = Array.isArray(item.format?.raw)
? item.format?.raw
: [item.format?.raw];
const formats_to_show = [];
if (format.includes('application/msword')) {
formats_to_show.push('DOC');
}
if (
format.includes(
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
)
) {
formats_to_show.push('DOCX');
}
if (format.includes('application/pdf')) {
formats_to_show.push('PDF');
}
return Object.entries(displayClusters).map(
([clusterName, cluster], index) => {
// protect against async cluster information not filled in yet
Expand All @@ -32,11 +46,9 @@ const ContentClusters = ({ clusters, item }) => {
</>
)}
{index < Object.keys(displayClusters).length - 1 ? ', ' : ''}
{format.includes('application/pdf') ? (
<span className="pdf-icon">PDF</span>
) : (
''
)}
{formats_to_show.map((format_to_show) => {
return <span className="fileformat-icon">{format_to_show}</span>;
})}
</div>
</div>
) : null;
Expand Down
2 changes: 1 addition & 1 deletion src/SearchBlock/less/searchresult.less
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
margin: 0;
}

.pdf-icon {
.fileformat-icon {
display: inline-block;
padding: 0 3px;
border: 1px solid @sf-medium-gray;
Expand Down

0 comments on commit a24f11c

Please sign in to comment.