Skip to content

Commit

Permalink
Add configuration: new confg
Browse files Browse the repository at this point in the history
  • Loading branch information
NopAngel committed Sep 28, 2024
1 parent 5d189b8 commit 1d8873f
Show file tree
Hide file tree
Showing 11 changed files with 298 additions and 32 deletions.
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="EmojiX es una librería de emojis que te permite buscar y guardar tus favoritos." />
<title>EmojiX | Librería de Emojis.</title>
<meta name="author" content="NopAngel">
<meta property="og:title" content="EmojiX | Librería de Emojis" />
<meta property="og:description" content="Descubre y comparte emojis con EmojiX, tu librería de emojis favorita." />

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@EmojiX" />
<meta name="twitter:title" content="EmojiX | Librería de Emojis" />
<meta name="twitter:description" content="Descubre y comparte emojis con EmojiX, tu librería de emojis favorita." />
<meta name="twitter:image" content="/logo.png" />
</head>
<body>
<div id="app"></div>
Expand Down
39 changes: 14 additions & 25 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"vite": "^5.2.0"
},
"dependencies": {
"svelte-sonner": "^0.3.28",
"svelte-spa-router": "^4.0.1"
}
}

9 changes: 6 additions & 3 deletions src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<script>
import Router from "svelte-spa-router";
import Card from "./components/Cards/Card.svelte";
import Navbar from "./components/Navbar.svelte";
import routes from "./routes/route";
import { Toaster, toast } from 'svelte-sonner'
</script>

<Navbar />
<Router {routes} />
<main>
<Toaster />
<Navbar />
<Router {routes} />
</main>
4 changes: 4 additions & 0 deletions src/app.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');


@tailwind base;
@tailwind components;
@tailwind utilities;

html{
font-family: 'Poppins', sans-serif;
color-scheme: dark;
}
50 changes: 48 additions & 2 deletions src/components/Cards/Card.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,71 @@
<script>
import { Toaster, toast } from 'svelte-sonner'
export let emoji;
export let name;
export let id;
export let type;
export let isButtonSaved;
function saveEmojiType() {
let savedEmojis = JSON.parse(localStorage.getItem("savedEmojis")) || [];
const emojiData = { emoji, name, id, type };
// Verificar si el emoji ya existe en la lista
const existingIndex = savedEmojis.findIndex(item => item.id === id);
if (existingIndex !== -1) {
// Si existe, actualizamos la información
savedEmojis[existingIndex] = emojiData;
} else {
// Si no existe, lo añadimos a la lista
savedEmojis.push(emojiData);
}
localStorage.setItem("savedEmojis", JSON.stringify(savedEmojis));
console.log(`Emoji guardado: ${emoji}`);
toast.success("Se a guardado el emoji.")
}
function removeEmojis() {
let savedEmojis = JSON.parse(localStorage.getItem("savedEmojis")) || [];
savedEmojis = savedEmojis.filter((item) => item.id !== id);
localStorage.setItem("savedEmojis", JSON.stringify(savedEmojis));
console.log(`Emoji eliminado: ${emoji}`);
toast.success("Se a borrado el emoji.")
}
</script>

<article
id={`${id}-card`}
class="lg:max-w-[250px] rounded-lg hover:cursor-pointer hover:-translate-y-6 transition-transform border-[1px] border-neutral-800 flex items-center justify-center h-fit"
class="lg:max-w-[250px] h-[350px] rounded-lg hover:cursor-pointer border-[1px] border-neutral-800 flex items-center justify-center"
>
<div class="text-center">
<div class="mt-3">
<h1 class="text-3xl">{emoji}</h1>
<h1 class="text-3xl font-semibold">{emoji}</h1>
</div>
<section class="p-4">
<h1 class="text-xl p-2">{name}</h1>
<article
class="w-fit mx-auto pl-10 pr-10 bg-neutral-800/55 p-[3px] rounded-xl border-[1px] opacity-70 border-neutral-700/55"
>

<span>{type}</span>

</article>
<div class="mt-4">
{#if isButtonSaved === true}
<button class="bg-neutral-800/55 p-2 rounded-xl border-[1px] border-neutral-700/55" on:click={saveEmojiType}>
Guardar
</button>
{:else}
<button class="bg-neutral-800/55 p-2 rounded-xl border-[1px] border-neutral-700/55 text-red-500" on:click={removeEmojis}>
Eliminar
</button>
{/if}
</div>
</section>
</div>
</article>
5 changes: 5 additions & 0 deletions src/components/Navbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
<a href="/#/api">API</a>
</li>

<li class="flex items-center gap-2">
<Cloud />
<a href="/#/saves">Guardados</a>
</li>

<li>
<a href="https://github.com/NopAngel/emojix" target="_blank">
<Github />
Expand Down
2 changes: 2 additions & 0 deletions src/routes/route.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import Api from "./routeapps/api.svelte";
import Home from "./routeapps/home.svelte";
import Saves from "./routeapps/saves.svelte";

const routes = {
'/': Home,
'/api': Api,
'/saves': Saves,
}

export default routes;
1 change: 1 addition & 0 deletions src/routes/routeapps/home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
id={data.id}
name={data.title}
type={data.type}
isButtonSaved={true}
/>
{/each}
</section>
Expand Down
22 changes: 22 additions & 0 deletions src/routes/routeapps/saves.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<script>
import Card from "../../components/Cards/Card.svelte";
let savedEmojis = JSON.parse(localStorage.getItem("savedEmojis")) || [];
</script>

<main>
<section
class="xl:w-fit mt-10 mx-auto grid xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2 grid-cols-1 gap-6"
>
{#each savedEmojis as emojis}
<Card
emoji={emojis.emoji}
id={emojis.id}
name={emojis.name}
type={emojis.type}
isButtonSaved={false}
/>
{/each}
</section>
</main>

Loading

0 comments on commit 1d8873f

Please sign in to comment.