Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issues with v2 #44

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
375 changes: 193 additions & 182 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"shiki": "^1.6.1",
"shiki-es": "^0.14.0",
"svelte-toc": "^0.5.9",
"tocbot": "^4.29.0",
"vscode-oniguruma": "^2.0.1",
"vscode-textmate": "^9.0.0"
},
Expand Down
90 changes: 90 additions & 0 deletions src/lib/components/atoms/HeroCard.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<script lang="ts">
import MiniLogo from '$lib/icons/miniLogo.svelte';

export let title: string;
export let details: string;
export let version: string;
export let liveDemo: string;
export let learnMore: string;
</script>

<div class="details-card">
<div class="details-info">
<div>
<MiniLogo />
<h3>{title}</h3>
</div>
<a href={version} target="_blank" class="version">v 3.0.0</a>
</div>
<p>
{details}
</p>
<div class="details-info">
<a href={liveDemo} class="live-demo" target="_blank">Live demo</a>
<a href={learnMore} class="learn-btn">Learn more</a>
</div>
</div>

<style lang="scss">
.details-card {
background-color: rgba(26, 26, 26, 0.48);
padding: 1.5rem;
border-radius: 1.5rem;

p {
color: rgba(245, 245, 245, 0.8);
font-size: 16px;
min-height: 100px;
margin-top: 28px;
}
}

.details-info {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;

div {
display: flex;
flex-direction: row;
align-items: center;
gap: 4px;
}

h3 {
color: rgba(245, 245, 245, 0.96);
position: relative;
top: 0.2rem;
font-size: 24px;
}

.version {
border: 1px solid rgba(245, 245, 245, 0.96);
padding: 4px 12px;
border-radius: 1.5rem;
}

a {
border: 1px solid rgba(245, 245, 245, 0.96);
border-radius: 1.5rem;
color: rgba(245, 245, 245, 0.96);
padding: 12px 16px;
white-space: nowrap;
text-decoration: none;
font-size: 16px;
}

.live-demo {
background-color: rgba(255, 49, 0, 1);
}

.learn-btn {
background-color: transparent;
border: none;
padding-left: 6px;
text-decoration: underline;
white-space: nowrap;
}
}
</style>
15 changes: 11 additions & 4 deletions src/lib/components/atoms/Slider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@
.slider-container {
display: flex;
overflow-x: auto;
margin-top: 3rem;
width: 100vw;
margin: 3rem 0 0 0;
gap: 1rem;
scroll-behavior: smooth;
padding-bottom: 1rem;
box-sizing: border-box;
position: relative;
left: 0;

div {
flex: 0 0 300px;
flex: 0 0 auto;
width: 280px;
height: 280px;
display: flex;
flex-direction: column;
text-align: left;
height: 280px;
width: 500px;
padding: 1.5rem;
border-radius: 1.5rem;
background-color: rgba(255, 49, 0, 0.8);
box-sizing: border-box;
}

div:hover {
Expand All @@ -38,6 +43,8 @@

p {
margin-top: auto;
font-weight: 500;
font-size: 20px;
}
}
</style>
72 changes: 72 additions & 0 deletions src/lib/components/atoms/TableOfContents.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<!-- TableOfContents.svelte -->
<script lang="ts">
import { onMount } from 'svelte';

interface Section {
name: string;
id: string;
}

export let sections: Section[] = [];
export let activeSection = '';

const handleScroll = () => {
const scrollPosition = window.scrollY + 0; // Adjust based on offset

sections.forEach((section) => {
const sectionElement = document.getElementById(section.id);
if (sectionElement) {
const offsetTop = sectionElement.offsetTop;
const offsetHeight = sectionElement.offsetHeight;

if (scrollPosition >= offsetTop && scrollPosition < offsetTop + offsetHeight) {
activeSection = section.id;
}
}
});
};

onMount(() => {
if (sections.length > 0) {
activeSection = sections[0].id;
}

window.addEventListener('scroll', handleScroll);
return () => {
window.removeEventListener('scroll', handleScroll);
};
});
</script>

<nav class="sticky-nav">
<ul>
{#each sections as section}
<li class={section.id === activeSection ? 'active' : ''}>
<a href={'#' + section.id}>{section.name}</a>
</li>
{/each}
</ul>
</nav>

<style lang="scss">
@import '$lib/scss/breakpoints.scss';

.sticky-nav {
background: rgba(26, 26, 26, 1);
width: 350px; /* Set width for the nav */
padding-inline: 0; /* Padding around nav */
position: sticky; /* Keep it sticky within the viewport */
top: 40px; /* Adjust this to control when it becomes sticky */
z-index: 900; /* Ensure it stays on top */
}

.sticky-nav ul {
list-style: none; /* Remove default list styling */
padding: 0; /* Remove padding */
margin: 0; /* Remove margin */
}

.active {
font-weight: bold; /* Highlight the active section */
}
</style>
8 changes: 6 additions & 2 deletions src/lib/components/organisms/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<li>
<a
href="/torrent-tracker"
class={currentPath === '/tracker' ? 'active' : ''}
class={currentPath === '/torrent-tracker' ? 'active' : ''}
on:click={toggleMenu}>Tracker</a
>
</li>
Expand Down Expand Up @@ -84,7 +84,7 @@
flex-direction: row;
align-items: center;
justify-content: end;
gap: 5vh;
gap: 1rem;
margin-top: 2.2vh;
margin-bottom: 1vh;
list-style: none;
Expand All @@ -99,6 +99,10 @@
font-size: 1rem;
}

li > a:hover {
color: white;
}

.active {
position: relative;
color: white;
Expand Down
109 changes: 15 additions & 94 deletions src/lib/components/organisms/Hero.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import MiniLogo from '$lib/icons/miniLogo.svelte';
import HeroCard from '$lib/components/atoms/HeroCard.svelte';
</script>

<div class="svg-container">
Expand All @@ -10,40 +10,20 @@
your own torrent indexes with ease.
</p>
<div class="details">
<div class="details-card">
<div class="details-info">
<div>
<MiniLogo />
<p>index</p>
</div>
<p class="version">v 3.0.0</p>
</div>
<p>
The Index is a feature-rich torrent indexing site split between an API (backend) built
with Rust, and our reference web app that consumes the API, built with Vue 3.
</p>
<div class="details-info">
<button>Live demo</button>
<button class="learn-btn">Learn more</button>
</div>
</div>
<div class="details-card">
<div class="details-info">
<div>
<MiniLogo />
<p>tracker</p>
</div>
<p class="version">v 3.0.0</p>
</div>
<p>
A lightweight Rust-based BitTorrent tracker for efficient torrent serving to many peers
with high performance, robustness, security, and community support.
</p>
<div class="details-info">
<button>Live demo</button>
<button class="learn-btn">Learn more</button>
</div>
</div>
<HeroCard
title={'index'}
details={'The Index is a feature-rich torrent indexing site split between an API (backend) built with Rust, and our reference web app that consumes the API, built with Vue 3.'}
version={'https://github.com/torrust/torrust-index/releases'}
liveDemo={'https://index.torrust-demo.com/torrents'}
learnMore={'/torrent-index'}
/>
<HeroCard
title={'tracker'}
details={'A lightweight Rust-based BitTorrent tracker for efficient torrent serving to many peers with high performance, robustness, security, and community support.'}
version={'https://github.com/torrust/torrust-tracker/releases'}
liveDemo={'https://index.torrust-demo.com/torrents'}
learnMore={'/torrent-tracker'}
/>
</div>
</div>
</div>
Expand Down Expand Up @@ -108,15 +88,6 @@
align-items: stretch;
margin-block: 4rem;

div {
flex: 1;
border-radius: 1.5rem;
}

p {
margin-top: 0.5rem;
}

@include for-tablet-portrait-up {
flex-direction: row;
max-width: 1050px;
Expand All @@ -128,54 +99,4 @@
margin-inline: auto;
}
}

.details-card {
background-color: rgba(26, 26, 26, 0.48);
padding: 1.5rem;
}

.details-card > p:nth-child(2) {
margin-top: 28px;
}

.details-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-block: 1.5rem;
flex-wrap: nowrap;

div {
display: flex;
flex-direction: row;
align-items: center;
}

div p {
font-size: 32px;
}

.version {
border: 1px solid rgba(245, 245, 245, 0.96);
padding: 4px 12px;
border-radius: 1.5rem;
}

button {
border: 1px solid rgba(245, 245, 245, 0.96);
border-radius: 1.5rem;
background-color: rgba(255, 49, 0, 1);
color: rgba(245, 245, 245, 0.96);
padding: 12px 16px;
white-space: nowrap;
}

.learn-btn {
background-color: transparent;
border: none;
padding-left: 6px;
text-decoration: underline;
white-space: nowrap;
}
}
</style>
Loading
Loading