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

Create projects route and add list each project in a card #41

Merged
merged 11 commits into from
Aug 5, 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
7 changes: 7 additions & 0 deletions src/app.postcss
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
@font-face {
font-family: "Fira Code";
src: local("fira-code"), url("/fonts/fira-code/FiraCode-VariableFont_wght.ttf");
}
}
34 changes: 34 additions & 0 deletions src/lib/components/CommonCard.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<script lang="ts">
import Tag from "$lib/components/Tag.svelte";

type Props = {
term: string;
name: string;
category: string;
description: string;
// authors: string[];
};

let { term, name, category, description /* , authors */ }: Props = $props();
</script>

<!-- TODO: Use semantic CSS https://www.magentaa11y.com/checklist-web/link/#complex-examples -->
<div class="m-4 max-w-72 rounded-2xl bg-neutral-800 px-6 py-4">
<div class="mb-4">
<span class="font-fira font-medium text-lime-500">{term}</span>
<h2 class="font-fira text-xl font-medium text-white">{name}</h2>
</div>
<Tag {category} />
<p class="my-4">{description}</p>
<div class="flex w-full flex-row justify-between">
<div class="flex flex-row items-center justify-center">
<!-- TODO: Implement author's avatars -->
<!-- {#each authors as author}
<img src="https://via.placeholder.com/150" alt={author} class="h-4 w-4 rounded-full" />
{/each} -->
</div>
<button class="rounded-full bg-lime-500 px-2 font-fira text-sm font-bold text-black">
Ver más
</button>
</div>
</div>
13 changes: 13 additions & 0 deletions src/lib/components/Tag.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<script lang="ts">
type Props = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mismo asunto que con el componente MoreButton

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta Tag se usa en otros lados, no solo en la ProjectCard.

category: string;
};

let { category }: Props = $props();
</script>

<span
class="rounded-full border border-lime-500 bg-neutral-800 px-6 font-fira font-bold text-white"
>
{category}
</span>
25 changes: 25 additions & 0 deletions src/lib/data/projects.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"projects": [
{
"term": "2024-1s",
"name": "Polipromedios",
"category": "web",
"description": "Descripción de un proyecto super genial, muy, muy, muy pero muy genial.",
"authors": ["Person 1", "Person 2"]
},
{
"term": "2024-1s",
"name": "Polipromedios",
"category": "web",
"description": "Descripción de un proyecto super genial, muy, muy, muy pero muy genial.",
"authors": ["Person 1", "Person 2"]
},
{
"term": "2024-1s",
"name": "Polipromedios",
"category": "web",
"description": "Descripción de un proyecto super genial, muy, muy, muy pero muy genial.",
"authors": ["Person 1", "Person 2"]
}
]
}
17 changes: 17 additions & 0 deletions src/routes/projects/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<script lang="ts">
import CommonCard from "$lib/components/CommonCard.svelte";

let { data } = $props();
adriandelgado marked this conversation as resolved.
Show resolved Hide resolved
</script>

<p class="font-medium">{data.description}</p>
<div class="mt-8 flex flex-col items-center sm:flex sm:flex-row sm:flex-wrap">
{#each data.projects as project}
<CommonCard
term={project.term}
name={project.name}
category={project.category}
description={project.description}
/>
{/each}
</div>
12 changes: 12 additions & 0 deletions src/routes/projects/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { PageLoad } from "./$types";
import { projects } from "$lib/data/projects.json";

export const load = (async () => {
return {
title: "Proyectos",
// TODO: change this to a real description
description: "Aquí ponemos los proyectos que nos enorgullecen... y lo que hay ¯\\_(ツ)_/¯",
// TODO: fetch from API
projects,
};
}) satisfies PageLoad;
Binary file not shown.
6 changes: 5 additions & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ export default {
darkMode: ["class"],
content: ["./src/**/*.{html,js,svelte,ts}"],
theme: {
extend: {},
extend: {
fontFamily: {
fira: ["Fira Code", "mono-space"],
},
},
},
plugins: [forms({ strategy: "class" }), typography],
} satisfies Config;
Loading