Skip to content

Commit

Permalink
Organise components
Browse files Browse the repository at this point in the history
  • Loading branch information
MaddyGuthridge committed May 19, 2024
1 parent 715fa73 commit de78781
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 20 deletions.
10 changes: 10 additions & 0 deletions src/components/Separator.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<div />

<style>
div {
background-color: black;
width: 1px;
height: 25px;
margin: 0 5px;
}
</style>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import type { TProject } from '$types';
import type { TLanguageMap } from '$types/language';
import Card from './Card.svelte';
import ChipList from './ChipList.svelte';
import LangChip from './LanguageChip.svelte';
import { ChipList, LanguageChip } from '$components/chip';
export let info: TProject;
export let languages: TLanguageMap;
Expand All @@ -17,7 +16,7 @@
<p>{info.description}</p>
<ChipList>
{#each info.languages as lang}
<LangChip link selected info={languages[lang]} />
<LanguageChip link selected info={languages[lang]} />
{/each}
</ChipList>
</Card>
3 changes: 3 additions & 0 deletions src/components/card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as Card } from './Card.svelte';
export { default as ProjectCard } from './ProjectCard.svelte';
export { default as LanguageCard } from './LanguageCard.svelte';
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
div {
display: flex;
gap: 5px;
align-items: center;
}
</style>
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions src/components/chip/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as Chip } from './Chip.svelte';
export { default as ChipList } from './ChipList.svelte';
export { default as LanguageChip } from './LanguageChip.svelte';
export { default as FrameworkChip } from './FrameworkChip.svelte';
10 changes: 10 additions & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
export { default as Markdown } from './Markdown.svelte';
export { default as Navbar } from './Navbar.svelte';
export { default as Separator } from './Separator.svelte';
// export { default as AsciinemaPlayer } from './AsciinemaPlayer.svelte';

import * as chip from './chip';
export { chip };

import * as card from './card';
export { card };
10 changes: 4 additions & 6 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import { filterProjectsByLanguages } from '$lib/util';
import ProjectCard from '$components/ProjectCard.svelte';
import LangChip from '$components/LanguageChip.svelte';
import Navbar from '$components/Navbar.svelte';
import Markdown from '$components/Markdown.svelte';
import ChipList from '$components/ChipList.svelte';
import { Navbar, Markdown } from '$components';
import { ProjectCard } from '$components/card';
import { ChipList, LanguageChip } from '$components/chip';
export let data: import('./$types').PageData;
Expand Down Expand Up @@ -47,7 +45,7 @@

<ChipList>
{#each data.languages as lang (lang.slug)}
<LangChip
<LanguageChip
on:click={() => selectLang(lang.slug)}
selected={selectedLangs.includes(lang.slug)}
info={lang}
Expand Down
4 changes: 2 additions & 2 deletions src/routes/languages/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import Navbar from '$components/Navbar.svelte';
import LanguageCard from '$components/LanguageCard.svelte';
import { Navbar } from '$components';
import { LanguageCard } from '$components/card';
export let data: import('./$types').PageData;
</script>
Expand Down
4 changes: 1 addition & 3 deletions src/routes/languages/[language]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<script lang="ts">
import Markdown from '$components/Markdown.svelte';
import LangChip from '$components/LanguageChip.svelte';
import Navbar from '$components/Navbar.svelte';
import { Markdown, Navbar } from '$components';
export let data: import('./$types').PageData;
</script>
Expand Down
10 changes: 4 additions & 6 deletions src/routes/projects/[project]/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script lang="ts">
import Markdown from '$components/Markdown.svelte';
import LanguageChip from '$components/LanguageChip.svelte';
import FrameworkChip from '$components/FrameworkChip.svelte';
import Navbar from '$components/Navbar.svelte';
import ChipList from '$components/ChipList.svelte';
// import AsciinemaPlayer from "$components/AsciinemaPlayer.svelte";
import { Navbar, Markdown, Separator } from '$components';
import { ChipList, LanguageChip, FrameworkChip } from '$components/chip';
// import AsciinemaPlayer from "$components";
export let data: import('./$types').PageData;
</script>
Expand All @@ -22,6 +19,7 @@
<LanguageChip info={data.languages[lang]} selected link />
{/each}
<!-- Frameworks -->
<Separator />
{#each data.info.frameworks as lang}
<FrameworkChip info={data.frameworks[lang]} selected link />
{/each}
Expand Down

0 comments on commit de78781

Please sign in to comment.