Skip to content

Commit

Permalink
✨ Ecosystems page is here
Browse files Browse the repository at this point in the history
  • Loading branch information
EssamWisam committed Jun 10, 2024
1 parent cfff5e7 commit ba59894
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 53 deletions.
8 changes: 5 additions & 3 deletions src/data/EcosystemPage.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
title: It's Beyond Just an [Ecosystem]...It's the [MLJ Universe]

title: The MLJ Universe
hint: Repositories of some possible interest outside of MLJ, or beyond its conventional use, are marked with a ⟂ symbol
organizations:
- orgName: MLJ.jl
orgLink: https://github.com/JuliaAI/MLJ.jl
Expand Down Expand Up @@ -128,4 +128,6 @@ organizations:
orgMarkdownDesc: |
MLJTestIntegration provides tests for the entire MLJ ecosystem. (Called when you run `ENV["MLJ_TEST_INTEGRATION"]="true";
Pkg.test("MLJ")`).
orthogonal: false
orthogonal: false

finalHint: Looking for a more sophisticated representation that exposes dependencies between packages? See the [following figure](https://raw.githubusercontent.com/JuliaAI/MLJ.jl/dev/material/MLJ_stack.svg).
2 changes: 1 addition & 1 deletion src/lib/Common/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
color: #fff;
margin-top: 2rem;
// margin-top: 2rem;
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/lib/Common/Title.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<script lang="ts">
export let text = "";
export let boring = false;
let htmlText = text.replace(/\[/g, '<span>').replace(/\]/g, '</span>');
</script>

<div class="headline">
<h1>
<div class="headline" style={'align-items:' + (boring ? 'flex-start' : 'center')}>
<h1 style={(boring) ? "" : "font-style: italic; width: 80%;"}>
{@html htmlText}
</h1>
</div>
Expand All @@ -26,10 +26,8 @@
margin: 1rem;
font-family: 'Lato';
font-weight: 700;
font-style: italic;
font-size: 2.4rem;
text-align: center;
width: 80%;
}
:global(span) {
color: darkmagenta;
Expand Down
153 changes: 110 additions & 43 deletions src/lib/EcosystemPage/Ecosystem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import SvelteMarkdown from 'svelte-markdown';
import { goto } from '$app/navigation';
import { Tooltip } from '@svelte-plugins/tooltips';
import Modal from '$lib/EcosystemPage/Modal.svelte';
let ecosystemData = YAML.parse(ecosystemDataYaml);
Expand All @@ -19,95 +20,161 @@
return str;
}
let showModal = false;
let modalTitle = '';
let modalText = '';
let modalLink = '';
function openModal(title: string, text: string, link: string) {
showModal = true;
modalTitle = title;
modalText = text;
modalLink = link;
}
function closeModal() {
showModal = false;
modalTitle = '';
modalText = '';
modalLink = '';
}
</script>

<Title text={ecosystemData['title']} />
This is still under construction.
<div class="grid-container">
{#each ecosystemData['organizations'] as org, index}
<button
class="grid-item {index === 0 ? 'grid-item-large' : (index === 1) ? 'grid-item-wide' : ''}"
on:click={() => goto(org.orgLink)}
>
<div
style="display: flex; gap: 0.5rem; align-items: center; flex-direction: row; justify-content:center;"
<!-- This is still under construction. -->
<div class="background-wrapper">
<h1
style="color: white; font-size: 2.5rem; text-align:center; padding-top: 2rem; letter-spacing: 5px; font-family: 'Exo 2'"
>
Enter the MLJ Universe
</h1>
<div class="markdown-holder">
<p style="text-align:'center'; color: #e1e1e1aa">
<SvelteMarkdown source={ecosystemData['hint']} />
</p>
</div>
<div class="grid-container">
{#each ecosystemData['organizations'] as org, index}
<button
class="grid-item {index === 0 ? 'grid-item-large' : index === 1 ? 'grid-item-wide' : ''}"
on:click={() => {
openModal(org.orgName, org.orgMarkdownDesc, org.orgLink);
}}
>
{#if org.orgName.startsWith('MLJ')}
<img
style="width: {index === 0 ? '200px' : '80px'}"
class="mlj-logo"
src="./mlj-logo.png"
/>
{/if}
<div
style="display: flex; gap: 0.5rem; align-items: center; flex-direction: row; justify-content:center;"
>
{#if org.orgName.startsWith('MLJ')}
<img
alt="logo"
style="width: {index === 0 ? '200px' : '80px'}"
class="mlj-logo"
src="./mlj-logo.png"
/>
{/if}
<div>
<h3
style="font-family: 'Lato'; font-style: italic; letter-spacing: -0.8px; font-size: 2rem;"
>
{cleanString(org.orgName)}
</h3>
</div>
</div>
<div>
<h3
style="font-family: 'Lato'; font-style: italic; letter-spacing: -0.8px; font-size: 2rem;"
>
{cleanString(org.orgName)}
</h3>
<a href={org.orgLink}> {org.orgName + ((org.orthogonal) ? '' : '')} </a>
</div>
</div>
<div>
<a href={org.orgLink}> {org.orgName} </a>
</div>
</button>
{/each}
</button>
{/each}
</div>
<div class="markdown-holder">
<p style="text-align:'center';">
<SvelteMarkdown source={ecosystemData['finalHint']} />
</p>
</div>
</div>
<Modal {showModal} name={modalTitle} text={modalText} link={modalLink} on:closeModal={closeModal} />


<style lang="scss">
.background-wrapper {
background: rgb(100, 50, 100); /* Fallback background color */
background: linear-gradient(to bottom, rgb(100, 50, 100), rgb(57, 39, 57));
background-size: 100% 100%;
}
.grid-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 16px;
padding: 40px;
// handle phone
@media screen and (max-width: 600px) {
// make them all in one column
display: flex;
flex-direction: column;
gap: 16px;
padding: 16px;
}
}
.grid-item {
background-color: #f9f9f9;
background-color: #00000044;
border: 1px solid #ddd;
padding: 25px;
text-align: center;
transition: background-color 0.3s ease;
border-radius: 15px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
a {
font-family: 'Lato';
font-size: 0.9rem;
font-weight: 500 !important;
color: #606060;
color: #ffffff !important;
}
h3 {
background-image: linear-gradient(200deg, rgb(3, 183, 3), rgb(58, 87, 229), rgb(160, 44, 166),);
h3 {
background: #fff;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
}
}
.grid-item-large {
grid-column: span 2;
grid-row: span 2;
}
.grid-item-wide {
grid-column: span 2;
}
.grid-item-wide {
grid-column: span 2;
}
.grid-item a {
text-decoration: none;
color: #333;
}
.grid-item:hover {
background-color: #eaeaea;
background-color: #00000066;
}
.mlj-logo {
width: 100px;
}
.markdown-holder {
display: flex;
flex-direction: column;
align-items: center;
padding: 1rem 3rem;
p {
color: #e1e1e1aa;
}
:global(a) {
text-decoration: underline;
}
@media screen and (max-width: 600px) {
padding: 1rem 1rem;
}
}
</style>
129 changes: 129 additions & 0 deletions src/lib/EcosystemPage/Modal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
<script lang="ts">
import { createEventDispatcher } from 'svelte';
import SvelteMarkdown from 'svelte-markdown';
const dispatch = createEventDispatcher();
export let showModal: boolean = false;
export let name: string = '';
export let text: string = '';
export let link: string = '';
function closeModal() {
dispatch('closeModal');
}
function handleClick(event: MouseEvent) {
if (event.target === event.currentTarget) {
closeModal();
}
}
</script>

{#if showModal}
<button class="modal" on:click={handleClick}>
<div class="modal-content">
<h3>{name}</h3>
<div style="display: flex; flex-direction: row; gap: 5rem;">
<SvelteMarkdown source={text} />
</div>
<div class="buttons">
<button on:click={closeModal}>Go Back</button>
<button on:click={()=>window.open(link, '_blank')}>See {name}</button>
</div>
</div>
</button>
{/if}

<style lang="scss">
.modal {
display: block;
position: fixed;
z-index: 999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: hidden;
background-color: rgba(0, 0, 0, 0.4);
border-radius: 1.5rem;
color: white;
cursor: auto !important;
}
.modal-content {
background-color: #5d3561;
margin: 5% auto;
max-width: 60%;
@media screen and (max-width: 600px) {
max-width: 90%;
}
border-radius: 1.5rem;
position: relative;
padding: 30px 10px;
display: flex;
flex-direction: column;
align-items: center;
:global(p) {
color: white;
font-family: 'Poppins';
text-align: justify;
font-size: 1.0rem;
margin: 0rem 1rem;
line-height: 1.5rem;
background-color: #00000033;
padding: 20px;
border-radius: 10px;
cursor: text !important;
}
:global(h3) {
color: white;
font-family: 'Lato';
font-style: italic;
font-size: 2rem;
text-align: center;
margin-bottom: 1rem;
}
:global(a) {
text-decoration: underline;
cursor: pointer !important;
}
}
.close {
color: #aaa;
position: absolute;
right: 15px;
top: 3px;
font-size: 1.3rem;
font-weight: bold;
}
.buttons {
display: flex;
justify-content: center;
align-items: center;
padding: 1rem;
margin-top: 1rem;
gap: 2rem;
// for small screen make flex direction column
@media screen and (max-width: 600px) {
flex-direction: column;
}
button {
background-color: #00000033;
padding: 0.5rem 2rem;
border-radius: 1rem;
font-family: Poppins;
font-size: 0.9rem;
color: white;
}
button:hover {
background-color: #ffffff;
color: black;
}
}
</style>
Loading

0 comments on commit ba59894

Please sign in to comment.