-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
298 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ | |
"vite": "^5.2.0" | ||
}, | ||
"dependencies": { | ||
"svelte-sonner": "^0.3.28", | ||
"svelte-spa-router": "^4.0.1" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
id={data.id} | ||
name={data.title} | ||
type={data.type} | ||
isButtonSaved={true} | ||
/> | ||
{/each} | ||
</section> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
|
Oops, something went wrong.