-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add organism selector for browse and submit pages (#1113)
* add organism selector * update
- Loading branch information
1 parent
27833ec
commit 3cb7cde
Showing
2 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
import { getConfiguredOrganisms } from '../../config'; | ||
import BaseLayout from '../../layouts/BaseLayout.astro'; | ||
import { routes } from '../../routes'; | ||
const redirectTo = Astro.params.redirectTo; | ||
const purposes: { [key: string]: string } = { | ||
submit: 'for which you want to submit data', | ||
search: 'for which you want to browse data', | ||
}; | ||
interface Routes { | ||
[key: string]: (organism: string) => string; | ||
} | ||
const myRoutes: Routes = { | ||
submit: routes.submitPage, | ||
search: routes.searchPage, | ||
}; | ||
const purpose = purposes[redirectTo!]; | ||
--- | ||
|
||
<BaseLayout title='Home'> | ||
<div class='max-w-6xl mx-auto'> | ||
<p class='text-gray-700 my-4'> | ||
Please select an organism {purpose}. | ||
</p> | ||
|
||
<div class='flex flex-wrap'> | ||
{ | ||
getConfiguredOrganisms().map(({ key, displayName, image, description }) => ( | ||
<a | ||
href={myRoutes[redirectTo!](key)} | ||
class='block rounded border border-gray-300 p-4 m-2 w-64 text-center hover:bg-gray-100' | ||
> | ||
{image !== undefined && <img src={image} class='h-32 mx-auto mb-4' alt={displayName} />} | ||
<h3 class='font-semibold text-gray-700'>{displayName}</h3> | ||
<p class='text-gray-700 text-sm'>{description}</p> | ||
</a> | ||
)) | ||
} | ||
</div> | ||
</div> | ||
</BaseLayout> |
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