-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
250 additions
and
72 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {} | ||
} | ||
autoprefixer: {}, | ||
}, | ||
}; |
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,5 @@ | ||
export interface Value { | ||
title: string; | ||
value?: string; | ||
valueSrc?: string; | ||
} |
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 |
---|---|---|
@@ -1,7 +1,171 @@ | ||
<script lang="ts"> | ||
import Content from '$lib/component/content.svelte'; | ||
import { branding } from '$lib/configuration'; | ||
import { ProgressRadial } from '@skeletonlabs/skeleton'; | ||
import type { PageData } from './$types'; | ||
import type { Value } from '$lib/models/value'; | ||
import * as api from '$lib/api'; | ||
import { onMount } from 'svelte'; | ||
export let data: PageData; | ||
let values: Value[]; | ||
let searchTerm = ''; | ||
onMount(async () => { | ||
//TODO: Update to use a real value endpoint | ||
values = await Promise.all( | ||
branding.landing.stats.map(async (stat) => { | ||
try { | ||
if (!stat.valueSrc) { | ||
return { value: stat.value, title: stat.title }; | ||
} | ||
const value = await api.post(stat.valueSrc, '', ''); //TODO: add token | ||
return { value, title: stat.title } as Value; | ||
} catch (e) { | ||
console.error(e); | ||
return { value: 'N/A', title: stat.title }; | ||
} | ||
}), | ||
); | ||
}); | ||
function search() { | ||
console.log('searching for:', searchTerm); | ||
} | ||
</script> | ||
|
||
<Content title="Home"> | ||
<p>Sample page data for the home page.</p> | ||
</Content> | ||
<div id="landing" class="landing"> | ||
<section id="search-section" class="flex flex-col text-center items-center search-section"> | ||
<div class="flex w-full"> | ||
<input | ||
id="search-box" | ||
type="search" | ||
autocomplete="off" | ||
class="search-box" | ||
aria-label="Type search terms here, use enter or the search button to submit search" | ||
title="Type search terms here, use enter or the search button to submit search" | ||
placeholder={branding.landing.searchPlaceholder || 'Search...'} | ||
bind:value={searchTerm} | ||
on:keydown={(e) => e.key === 'Enter' && search()} | ||
required | ||
/> | ||
<button | ||
id="search-button" | ||
class="btn variant-filled-primary search-button" | ||
aria-label="Search" | ||
title="Search" | ||
disabled={!searchTerm} | ||
on:click={search} | ||
>Search</button | ||
> | ||
</div> | ||
<p> | ||
{branding.landing.description || | ||
'PIC-SURE can be used to search phenotypic variables and genomic variants, apply filters, build cohorts, and export participant-level data.'} | ||
</p> | ||
</section> | ||
<section class="actions"> | ||
{#each branding.landing.actions as link} | ||
<a href={link.url} target="_blank" tabindex="0"> | ||
<i class={link.icon} /> | ||
<div>{link.description}</div> | ||
</a> | ||
{/each} | ||
</section> | ||
<section class="stats"> | ||
{#if values} | ||
{#each values as stat} | ||
<div class="flex flex-col"> | ||
<div id="value-{stat.title}" class="flex flex-col justify-center items-center"> | ||
{stat.value} | ||
</div> | ||
<p>{stat.title}</p> | ||
</div> | ||
{/each} | ||
{:else} | ||
{#each branding.landing.stats as stat} | ||
<div id="value-{stat.title}" class="flex flex-col justify-center items-center"> | ||
<ProgressRadial width="w-10" value={undefined} /> | ||
<p>{stat.title}</p> | ||
</div> | ||
{/each} | ||
{/if} | ||
</section> | ||
</div> | ||
|
||
<style> | ||
#landing { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
height: 100%; | ||
width: 100%; | ||
padding: 2rem; | ||
text-align: center; | ||
} | ||
#landing input[type='search'] { | ||
width: 100%; | ||
box-sizing: border-box; | ||
margin-right: 0.5rem; | ||
@apply input; | ||
} | ||
#landing #search-section p { | ||
max-width: 50rem; | ||
margin: 1rem 0; | ||
color: grey; | ||
} | ||
#landing section#search-section { | ||
width: 70%; | ||
} | ||
#landing .actions { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-evenly; | ||
margin: 2rem 0; | ||
} | ||
#landing .actions a { | ||
color: rgb(var(--text-secondary-500)); | ||
text-decoration: none; | ||
display: flex; | ||
flex-direction: column; | ||
text-align: center; | ||
max-width: 12.5rem; | ||
padding: 1rem 0.5rem; | ||
margin: 0.3rem; | ||
} | ||
#landing .actions a i { | ||
color: rgb(var(--color-primary-500)); | ||
} | ||
#landing .actions a:hover, | ||
#landing .actions a:active { | ||
transform: scale(1.05); | ||
} | ||
#landing .stats { | ||
display: flex; | ||
flex-direction: row; | ||
justify-content: space-evenly; | ||
align-items: center; | ||
width: 70%; | ||
margin: 2rem 0; | ||
padding: 2rem; | ||
@apply card variant-filled-primary; | ||
} | ||
#landing .stats .stat { | ||
max-width: 10rem; | ||
} | ||
#landing .stats div { | ||
font-size: 1.5rem; | ||
} | ||
#landing .stats p { | ||
font-size: 1rem; | ||
} | ||
</style> |
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
Oops, something went wrong.