Skip to content

Commit

Permalink
Update language title IDs
Browse files Browse the repository at this point in the history
Pretty names like `C#` aren't the most URL-friendly.
  • Loading branch information
spenserblack committed Aug 25, 2023
1 parent 07dd12f commit 9779742
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions docs/vercel/src/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,14 @@
href="https://github.com/o2sh/onefetch">github.com/o2sh/onefetch</a>
</p>
<h3>Languages <small>({languages.length})</small></h3>
{#each languages as language}
{#each languages as language, index}
<AsciiPreview
name={language.name}
ansi={language.ansi}
hex={language.hex}
ascii={language.ascii}
chip={language.chip} />
chip={language.chip}
{index} />
{/each}
</main>

Expand Down
3 changes: 2 additions & 1 deletion docs/vercel/src/lib/AsciiPreview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import TitleLink from './TitleLink.svelte';
export let name: string;
export let index: number;
export let ansi: string[];
export let hex: string[] | null = null;
export let chip: string;
Expand Down Expand Up @@ -36,7 +37,7 @@
<div class="title-row">
<div class="language-name">
<Chip id={name} color={chip} width={24} height={24} />
<TitleLink {name} />
<TitleLink {name} {index} />
</div>
<div class="checkbox">
<input id="dark-checkbox-{name}" type="checkbox" bind:checked={dark} />
Expand Down
5 changes: 4 additions & 1 deletion docs/vercel/src/lib/TitleLink.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<script lang="ts">
export let name: string;
export let index: number;
</script>

<h3 id={name}><a href="#{name}" class="title-link">{name}</a></h3>
<h3 id="language-{index}">
<a href="#language-{index}" class="title-link">{name}</a>
</h3>

<style>
.title-link,
Expand Down

0 comments on commit 9779742

Please sign in to comment.