Initial Modal Work

This commit is contained in:
Sangelo 2023-12-10 01:00:02 +01:00
parent 1de840fb78
commit 88b13a0aef
19 changed files with 578 additions and 18 deletions

View file

@ -31,6 +31,7 @@
},
"type": "module",
"dependencies": {
"md-block": "^0.0.1",
"svelte-material-icons": "^3.0.5",
"svelte-transition": "^0.0.10"
}

View file

@ -5,7 +5,8 @@
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
<script type="module" src="https://cdn.jsdelivr.net/gh/zerodevx/zero-md@2/dist/zero-md.min.js"></script>
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">

View file

@ -3,6 +3,7 @@
/* imports */
// @use "styles/scrollbar.scss";
@import url("https://fonts.cdnfonts.com/css/manrope");
@import url('https://fonts.cdnfonts.com/css/hack');
/* general style */
html,
@ -43,6 +44,10 @@ h6.no-select{
text-decoration: underline;
}
code {
font-family: $font-family-mono;
}
/* Scrollbars */
// Firefox

116
src/routes/Modal.svelte Normal file
View file

@ -0,0 +1,116 @@
<script lang="ts">
import { fade, fly } from 'svelte/transition';
import type { SvelteComponent } from 'svelte';
import { onMount, onDestroy, createEventDispatcher } from 'svelte';
import IconCloseCircle from 'svelte-material-icons/CloseCircle.svelte';
import IconAlert from 'svelte-material-icons/Alert.svelte';
// Event dispatcher to communicate with the parent component
const dispatch = createEventDispatcher();
export let show: boolean = false;
export let contentComponent: typeof SvelteComponent | null;
// Function to handle the key press
function handleKeydown(event: KeyboardEvent) {
if (event.key === 'Escape') {
closeModal();
}
}
// Function to close the modal and notify the parent component
function closeModal() {
show = false;
dispatch('close');
}
onMount(() => {
if (typeof window !== 'undefined') {
window.addEventListener('keydown', handleKeydown);
}
});
onDestroy(() => {
if (typeof window !== 'undefined') {
window.removeEventListener('keydown', handleKeydown);
}
});
</script>
{#if show}
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div class="modal" on:click={closeModal} in:fade={{ duration: 100 }} out:fade={{ duration: 100 }}>
<!-- svelte-ignore a11y-click-events-have-key-events -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="modal-card"
on:click|stopPropagation
in:fly={{ y: 200, duration: 300 }}
out:fly={{ y: 200, duration: 300 }}
>
{#if contentComponent}
<button class="close-button" on:click={closeModal}><IconCloseCircle size="1.25em"/></button>
<svelte:component this={contentComponent} />
{:else}
<p class="error-msg"><span class="error-icon"><IconAlert size="1.5em"/></span><br>No content provided</p>
{/if}
</div>
</div>
{/if}
<style lang="scss">
.modal {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: center;
background-color: rgba(0, 0, 0, 0.5);
backdrop-filter: blur(8px);
z-index: 1000;
.modal-card {
height: 80%;
width: 85%;
position: relative;
background-color: $space-gray;
border-radius: 2em;
padding: 1em;
box-shadow: 0px 2px 10px $space-black-modal;
z-index: 1001;
overflow: scroll;
}
.close-button {
position: absolute;
top: 0.9em;
right: 0.8em;
background: none;
border: none;
font-size: 20px;
cursor: pointer;
z-index: 1002;
color: #fff;
}
.error-msg {
justify-self: center;
align-self: center;
}
.error-icon {
color: #fe8484;
}
}
@media (max-width: 850px) {
.modal {
.modal-card {
height: 85%;
}
}
}
</style>

View file

@ -1,5 +1,25 @@
<script lang="ts">
import { goto } from '$app/navigation';
import Modal from './Modal.svelte';
import DashinitModal from './modals/dashinit.svelte';
import SangeFaultModal from './modals/sangefault.svelte';
import ExploreCraftModal from './modals/explorecraft.svelte';
import UtilityClientModal from './modals/utilityclient.svelte';
import SangeloSpaceModal from './modals/sangelospace.svelte'
// import type { SvelteComponent } from 'svelte';
let showModal = false;
let selectedModule: any = null;
function openModalWith(module: any) {
selectedModule = module;
showModal = true;
}
function handleModalClose() {
showModal = false;
}
function smoothScrollTo(elementId: string) {
const element = document.getElementById(elementId);
@ -70,29 +90,32 @@
<div class="one">
<button class="button inactive" />
<button class="button inactive" />
<button class="button sangelo"></button>
<button class="button lunivity"></button>
<button class="button sangelo" on:click={() => openModalWith(SangeloSpaceModal)} />
<a href="https://lunivity.com" rel="noopener noreferrer" target="_blank"><button class="button lunivity" /></a>
</div>
<div class="two">
<button class="button gitpot"></button>
<button class="button utility"></button>
<button class="button explorecraft"></button>
<button class="button dashinit"></button>
<a href="https://gitpot.dev" rel="noopener noreferrer" target="_blank"><button class="button gitpot" /></a>
<button class="button utility" on:click={() => openModalWith(UtilityClientModal)} />
<button class="button explorecraft" on:click={() => openModalWith(ExploreCraftModal)} />
<button class="button dashinit" on:click={() => openModalWith(DashinitModal)} />
</div>
<div class="thr">
<button class="button inactive" />
<button class="button sangefault"></button>
<button class="button next"></button>
<button class="button sangefault" on:click={() => openModalWith(SangeFaultModal)} />
<button class="button next" />
<button class="button inactive" />
</div>
</div>
<div class="tip">
<p>
Click on a<br>
<span class="capri">bubble</span> for<br>
Click on a<br />
<span class="capri">bubble</span> for<br />
more <span class="french-sky">info</span>.
</p>
</div>
<!-- Show modals -->
<Modal show={showModal} on:close={handleModalClose} contentComponent={selectedModule} />
</div>
</content>
</div>

View file

@ -0,0 +1,49 @@
<script>
import IconOpenInNew from 'svelte-material-icons/OpenInNew.svelte';
let projectLogo = "assets/logos/dashinit.svg";
let projectReadme = "https://gitpot.dev/dashinit/cli/raw/branch/main/README.md";
let projectSite = "https://gitpot.dev/dashinit/cli";
</script>
<content>
<div class="parent">
<div class="gallery">
<img src="{projectLogo}" class="project-logo" alt="Project Logo" />
</div>
<div>
<zero-md class="markdown" src="{projectReadme}">
<template>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.4.0/github-markdown.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-atom-dark.min.css"
/>
<link
rel="stylesheet"
href="/assets/style/markdown.css"
/>
</template>
</zero-md>
</div>
</div>
<div class="button-container">
<a
class="button"
target="_blank"
rel="noopener noreferrer"
href="{projectSite}"
><button>
<IconOpenInNew size="1.2em" />
<p>Visit Project</p>
</button>
</a>
</div>
</content>
<style lang="scss">
@import '../../styles/modal.scss';
@import '../../styles/mobile/modal-mobile.scss';
</style>

View file

@ -0,0 +1,49 @@
<script>
import IconOpenInNew from 'svelte-material-icons/OpenInNew.svelte';
let projectLogo = "assets/logos/explorecraft.svg";
let projectReadme = "https://gitpot.dev/ExploreCraft/website/raw/branch/main/README.md";
let projectSite = "https://explorecraft.net";
</script>
<content>
<div class="parent">
<div class="gallery">
<img src="{projectLogo}" class="project-logo" alt="Project Logo" />
</div>
<div>
<zero-md class="markdown" src="{projectReadme}">
<template>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.4.0/github-markdown.css?123456789"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-atom-dark.min.css?123456789"
/>
<link
rel="stylesheet"
href="/assets/style/markdown.css"
/>
</template>
</zero-md>
</div>
</div>
<div class="button-container">
<a
class="button"
target="_blank"
rel="noopener noreferrer"
href="{projectSite}"
><button>
<IconOpenInNew size="1.2em" />
<p>Visit Project</p>
</button>
</a>
</div>
</content>
<style lang="scss">
@import '../../styles/modal.scss';
@import '../../styles/mobile/modal-mobile.scss';
</style>

View file

@ -0,0 +1,49 @@
<script>
import IconOpenInNew from 'svelte-material-icons/OpenInNew.svelte';
let projectLogo = "assets/logos/sangefault.svg";
let projectReadme = "https://gitpot.dev/sangelo/SangeFault/raw/branch/1.8.9/README.md";
let projectSite = "https://github.com/SangeloDev/SangeFault";
</script>
<content>
<div class="parent">
<div class="gallery">
<img src="{projectLogo}" class="project-logo" alt="Project Logo" />
</div>
<div>
<zero-md class="markdown" src="{projectReadme}">
<template>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.4.0/github-markdown.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-atom-dark.min.css"
/>
<link
rel="stylesheet"
href="/assets/style/markdown.css"
/>
</template>
</zero-md>
</div>
</div>
<div class="button-container">
<a
class="button"
target="_blank"
rel="noopener noreferrer"
href="{projectSite}"
><button>
<IconOpenInNew size="1.2em" />
<p>Visit Project</p>
</button>
</a>
</div>
</content>
<style lang="scss">
@import '../../styles/modal.scss';
@import '../../styles/mobile/modal-mobile.scss';
</style>

View file

@ -0,0 +1,49 @@
<script>
import IconOpenInNew from 'svelte-material-icons/OpenInNew.svelte';
let projectLogo = "assets/logos/sangelo.svg";
let projectReadme = "https://gitpot.dev/sangelo/website/raw/branch/main/README.md";
let projectSite = "https://gitpot.dev/sangelo/website";
</script>
<content>
<div class="parent">
<div class="gallery">
<img src="{projectLogo}" class="project-logo" alt="Project Logo" />
</div>
<div>
<zero-md class="markdown" src="{projectReadme}">
<template>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.4.0/github-markdown.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-atom-dark.min.css"
/>
<link
rel="stylesheet"
href="/assets/style/markdown.css"
/>
</template>
</zero-md>
</div>
</div>
<div class="button-container">
<a
class="button"
target="_blank"
rel="noopener noreferrer"
href="{projectSite}"
><button>
<IconOpenInNew size="1.2em" />
<p>Visit Project</p>
</button>
</a>
</div>
</content>
<style lang="scss">
@import '../../styles/modal.scss';
@import '../../styles/mobile/modal-mobile.scss';
</style>

View file

@ -0,0 +1,49 @@
<script>
import IconOpenInNew from 'svelte-material-icons/OpenInNew.svelte';
let projectLogo = "assets/logos/utilityclient.svg";
let projectReadme = "https://raw.githubusercontent.com/Utility-Client/UtilityClient/main/README.md";
let projectSite = "https://uc.gamingcraft.de";
</script>
<content>
<div class="parent">
<div class="gallery">
<img src="{projectLogo}" class="project-logo" alt="Project Logo" />
</div>
<div>
<zero-md class="markdown" src="{projectReadme}">
<template>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.4.0/github-markdown.css?123456789"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/prism-themes/1.9.0/prism-atom-dark.min.css?123456789"
/>
<link
rel="stylesheet"
href="/assets/style/markdown.css"
/>
</template>
</zero-md>
</div>
</div>
<div class="button-container">
<a
class="button"
target="_blank"
rel="noopener noreferrer"
href="{projectSite}"
><button>
<IconOpenInNew size="1.2em" />
<p>Visit Project</p>
</button>
</a>
</div>
</content>
<style lang="scss">
@import '../../styles/modal.scss';
@import '../../styles/mobile/modal-mobile.scss';
</style>

View file

@ -0,0 +1,36 @@
@media (max-width: 850px) {
content {
.parent {
display: grid;
grid-template-columns: repeat(1, 2fr);
grid-template-rows: auto 1fr; // Adjusted to 2 rows
grid-column-gap: 0px;
grid-row-gap: 0px;
overflow: scroll;
margin: 0 5% 15% 5%;
.gallery {
display: grid;
justify-items: center;
img.project-logo {
height: 5em;
margin-right: 0;
}
}
}
.button-container {
bottom: 7.5%;
&::before {
bottom: 5.9%;
width: 80%;
}
button {
font-size: 20px;
}
}
}
}

86
src/styles/modal.scss Normal file
View file

@ -0,0 +1,86 @@
content {
height: 100%;
text-align: left;
.parent {
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto;
grid-column-gap: 0px;
grid-row-gap: 0px;
overflow: hidden;
margin: 0.5em 5% 6% 0.5em;
.gallery {
img.project-logo {
margin-right: 2em;
border-radius: 0.8em;
height: 15em;
transition: ease-in-out 0.3s;
}
}
img.project-logo:hover {
box-shadow: 10px 10px 71px -32px rgba(0, 0, 0, 0.5);
-webkit-box-shadow: 10px 10px 71px -32px rgba(0,0,0,0.5);
}
}
.button-container {
z-index: 1000;
position: fixed;
bottom: 10%;
grid-area: 2 / 1 / 3 / 2;
align-self: start;
justify-self: start;
width: 85%;
// Create the gradient rectangle
&::before {
content: '';
position: fixed;
left: 9%;
bottom: calc(10% - 0.96em);
height: calc(100% + 1em); // 1em higher than the button
height: 15%;
width: 82%;
pointer-events: none;
background: linear-gradient(to top, $space-gray, transparent);
z-index: 1001; // Place it behind the button
}
button {
display: flex;
position: relative; // Ensure the button is above the gradient
z-index: 1002;
background-color: $deep-sky-blue;
color: white;
border: 0;
border-radius: 0.8em;
padding: 0.7em;
font-size: 20px;
font-weight: 600;
cursor: pointer;
transition: ease-in-out 0.1s;
p {
margin: 0;
margin-left: 0.5em;
}
}
button:hover {
opacity: 0.9;
}
button:active {
opacity: 0.8;
}
a.button {
display: inline-block;
text-decoration: none;
}
}
}

View file

@ -46,7 +46,7 @@
display: grid;
grid-template-columns: 8em 8em 8em 8em;
grid-template-rows: 8em 8em 8em;
gap: 2em 2em;
gap: 1em 2em;
grid-template-areas:
'one one one one'
'two two two two'
@ -82,6 +82,8 @@
margin: 0 0 0 2em;
overflow: hidden;
background-size: 8em;
background-position: center;
background-repeat: no-repeat;
}
.button:hover {
@ -129,8 +131,6 @@
background-color: $space-cadet;
background-image: url('/assets/icons/next.svg');
background-size: 3em;
background-position: center;
background-repeat: no-repeat;
}
.tip {
@ -138,7 +138,7 @@
text-align: left;
font-weight: 600;
font-size: 25px;
z-index: 100;
z-index: 1;
margin-left: 1em;
.capri {

View file

@ -12,8 +12,11 @@ $space-gray: #3e4053;
$star-gray: #878894;
$white: #ffffff;
// Tooltip Alpha
$space-gray-tooltip: #3e4053b2;
// Alpha Versions
$space-gray-tooltip: rgba(61, 63, 81, 0.69);
$space-black-modal: rgba(18, 19, 22, 0.2);
$space-gray-modal: rgba(61, 63, 81, 0.8);
// Font Family
$font-family: 'Manrope', sans-serif;
$font-family-mono: 'Hack', sans-serif;

View file

@ -0,0 +1,38 @@
.markdown-body {
/* padding: 0.5em;
border-radius: 12px; */
margin-top: 1em;
background: transparent;
font-family: 'Manrope', sans-serif;
overflow: auto;
h1,
h2 {
border-bottom: 1px solid #878894;
}
blockquote {
background-color: #2b2d426c;
color: #ffffff;
border-left: .25em solid #121316;
padding: 0.5em;
}
}
a {
color: #0091fb;
}
a:hover {
color: #00b2fa;
}
a:visited {
color: #00c4fb;
}
code {
font-family: 'Hack', sans-serif;
background-color: #2b2d42;
border-radius: 8px;
padding: 0.1em 0.2em 0.1em 0.2em;
}

View file

@ -0,0 +1 @@
# this directory is a fix for explorecraft project readme not loading screenshots

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

View file

@ -1111,6 +1111,11 @@ magic-string@^0.30.0, magic-string@^0.30.3, magic-string@^0.30.4:
dependencies:
"@jridgewell/sourcemap-codec" "^1.4.15"
md-block@^0.0.1:
version "0.0.1"
resolved "https://registry.yarnpkg.com/md-block/-/md-block-0.0.1.tgz#d2b8c34dbd7158333e603a482413162c49ac0fb8"
integrity sha512-uXAp27jR+ztgoWyQfaktpWYNbknlpzmeYfIkeYGwGjkZDXTcWmom9eVgUsjEn4/I9evLdfydWB0PIzHq9VjUwg==
mdn-data@2.0.30:
version "2.0.30"
resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-2.0.30.tgz#ce4df6f80af6cfbe218ecd5c552ba13c4dfa08cc"