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 10 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");
}
}
3 changes: 3 additions & 0 deletions src/lib/components/MoreButton.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<button class="rounded-full bg-lime-500 px-2 font-fira text-sm font-bold text-black">
adriandelgado marked this conversation as resolved.
Show resolved Hide resolved
Ver más
</button>
33 changes: 33 additions & 0 deletions src/lib/components/ProjectCard.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script lang="ts">
import Tag from "$lib/components/Tag.svelte";
import MoreButton from "$lib/components/MoreButton.svelte";

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.

Yo prefiero usar interface en lugar de type pero no se cual sea la convención que se haya establecido (o establecerá) en el proyecto

Copy link
Contributor

Choose a reason for hiding this comment

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

Las interfaces son víctima de cosas raras como Declaration Merging que las hacen menos estrictas que los Types. Además los types tienen capacidades extras como poder declarar Unions. En general, Interface es más OOP y Types es más functional style.

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>
<MoreButton />
</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"]
}
]
}
18 changes: 18 additions & 0 deletions src/routes/projects/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script lang="ts">
import ProjectCard from "$lib/components/ProjectCard.svelte";
import { projects } from "$lib/data/projects.json";

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 projects as project}
<ProjectCard
term={project.term}
name={project.name}
category={project.category}
description={project.description}
/>
{/each}
</div>
9 changes: 9 additions & 0 deletions src/routes/projects/+page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type { PageLoad } from "./$types";

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 ¯\\_(ツ)_/¯",
};
}) 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