-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add keyword filter link to project page
- Loading branch information
1 parent
a4b77d0
commit f3576a3
Showing
6 changed files
with
52 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-FileCopyrightText: 2022 Dusan Mijatovic (dv4all) | ||
// SPDX-FileCopyrightText: 2022 Ewan Cahen (Netherlands eScience Center) <e.cahen@esciencecenter.nl> | ||
// SPDX-FileCopyrightText: 2022 Netherlands eScience Center | ||
// SPDX-FileCopyrightText: 2022 dv4all | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
import {KeywordForProject} from '~/types/Project' | ||
import {ssrProjectsUrl} from '~/utils/postgrestUrl' | ||
import TagChipFilter from '../layout/TagChipFilter' | ||
|
||
type TagWithTitle = { | ||
title: string | ||
label: string | ||
} | ||
|
||
export default function ProjectKeywords({keywords=[]}:{keywords:KeywordForProject[]}) { | ||
|
||
function renderTags() { | ||
if (keywords.length === 0) { | ||
return <i>Not specified</i> | ||
} | ||
return ( | ||
<div className="flex flex-wrap py-1"> | ||
{ | ||
keywords.map((item, pos) => { | ||
const url = ssrProjectsUrl({keywords: [item.keyword]}) | ||
return <TagChipFilter url={url} key={pos} label={item.keyword} /> | ||
}) | ||
} | ||
</div> | ||
) | ||
} | ||
|
||
return ( | ||
<div> | ||
<h4 className="text-primary py-4"> | ||
Keywords | ||
</h4> | ||
{renderTags()} | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters