Skip to content

Commit

Permalink
fixed typos and renamed file
Browse files Browse the repository at this point in the history
  • Loading branch information
Farfi55 committed Jan 30, 2024
1 parent c9984e3 commit 83330e5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/lib/components/Main.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { tecnologies } from '$lib/Tecnologies';
import { technologies } from '$lib/technologies';
import type { Step } from '$lib/types';
import Button from './Button.svelte';
import Particles from './Particles.svelte';
Expand Down Expand Up @@ -68,9 +68,9 @@
My <span class="poppins text-main">Favourite tech</span> includes:
</p>
<ul class="flex flex-wrap justify-center lg:justify-start gap-4">
{#each tecnologies as tecnology (tecnology.name)}
{#if !tecnology.hide}
<Tech {tecnology} padding="px-1.5 py-1" />
{#each technologies as technology (technology.name)}
{#if !technology.hide}
<Tech {technology} padding="px-1.5 py-1" />
{/if}
{/each}
</ul>
Expand Down
24 changes: 12 additions & 12 deletions src/lib/components/Tech.svelte
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
<script lang="ts">
import { getTecnology } from '$lib/Tecnologies';
import type { Tecnology } from '$lib/types';
import { getTechnology } from '$lib/technologies';
import type { Technology } from '$lib/types';
export let openNewTab: boolean = true;
export let name: string | null = null;
export let tecnology: Tecnology | null = null;
export let technology: Technology | null = null;
$: {
if (name) {
tecnology = getTecnology(name);
technology = getTechnology(name);
}
}
export let padding = 'px-1 py-0.5';
export let color = '';
if (color === '' && tecnology?.color) {
color = tecnology.color;
if (color === '' && technology?.color) {
color = technology.color;
}
</script>

{#if tecnology}
<a href={tecnology.website ?? '#'} target={openNewTab ? '_blank' : '_self'} class="inline-block">
{#if technology}
<a href={technology.website ?? '#'} target={openNewTab ? '_blank' : '_self'} class="inline-block">
<div
class="flex {padding} gap-2 bg-stone-100 text-normal dark:bg-stone-800 dark:text-white rounded-md border-b-2 border-stone-300 hover:bg-stone-200 dark:hover:bg-stone-700 dark:border-stone-900 dark:hover:border-stone-800 hover:translate-y-1 duration-200 align-baseline"
>
{#if tecnology.iconSlug}
{#if technology.iconSlug}
<img
height="24"
width="24"
src="https://cdn.simpleicons.org/{tecnology.iconSlug}/{color}"
alt={tecnology.name}
src="https://cdn.simpleicons.org/{technology.iconSlug}/{color}"
alt={technology.name}
class="align-baseline"
/>
{/if}

<span class="self-baseline">{tecnology.name}</span>
<span class="self-baseline">{technology.name}</span>
</div>
</a>
{/if}
16 changes: 8 additions & 8 deletions src/lib/Tecnologies.ts → src/lib/technologies.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Tecnology } from "./types";
import type { Technology } from "./types";

export const tecnologies: Tecnology[] = [
export const technologies: Technology[] = [
{
name: 'Unity',
urlSlug: 'unity',
Expand Down Expand Up @@ -115,13 +115,13 @@ export const tecnologies: Tecnology[] = [
}
];

const tecnologiesMap: Map<string, Tecnology> = new Map();
tecnologies.forEach((t) => tecnologiesMap.set(t.name.toLowerCase(), t));
const technologiesMap: Map<string, Technology> = new Map();
technologies.forEach((t) => technologiesMap.set(t.name.toLowerCase(), t));

export function getTecnology(name: string): Tecnology {
const tecnology = tecnologiesMap.get(name.toLowerCase());
if (tecnology) return tecnology;
export function getTechnology(name: string): Technology {
const technology = technologiesMap.get(name.toLowerCase());
if (technology) return technology;

console.warn(`Tecnology ${name} not found, returning default`);
console.warn(`Technology ${name} not found, returning default`);
return { name: name.toString(), urlSlug: name.toString().toLowerCase() };
}
5 changes: 4 additions & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export interface Step {
icon: string;
href?: string;
description?: string;
}export interface Tecnology {
}

export interface Technology {
name: string;
urlSlug: string;
iconSlug?: string;
Expand All @@ -13,6 +15,7 @@ export interface Step {
color?: string;
hide?: boolean;
}

export type Post = {
title: string;
subtitle?: string;
Expand Down

0 comments on commit 83330e5

Please sign in to comment.