feat: use animated emojis from fluent
@ -2,16 +2,28 @@ import { isYoutubeLink } from "@lib/string.ts";
|
|||||||
import { IconBrandYoutube } from "@components/icons.tsx";
|
import { IconBrandYoutube } from "@components/icons.tsx";
|
||||||
|
|
||||||
export function Card(
|
export function Card(
|
||||||
{ link, title, image }: { link?: string; title?: string; image?: string },
|
{ link, title, image, backgroundSize = 100 }: {
|
||||||
|
backgroundSize?: number;
|
||||||
|
link?: string;
|
||||||
|
title?: string;
|
||||||
|
image?: string;
|
||||||
|
},
|
||||||
) {
|
) {
|
||||||
|
const backgroundStyle = {
|
||||||
|
backgroundImage: `url(${image})`,
|
||||||
|
backgroundSize: "cover",
|
||||||
|
};
|
||||||
|
|
||||||
|
if (backgroundSize !== 100) {
|
||||||
|
backgroundStyle["backgroundSize"] = `${backgroundSize}%`;
|
||||||
|
backgroundStyle["backgroundRepeat"] = "no-repeat";
|
||||||
|
backgroundStyle["backgroundPosition"] = "center";
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={link}
|
href={link}
|
||||||
style={{
|
style={backgroundStyle}
|
||||||
backgroundImage: `url(${image})`,
|
|
||||||
backgroundSize: "cover",
|
|
||||||
//background: "#2B2930",
|
|
||||||
}}
|
|
||||||
class="text-white rounded-3xl shadow-md p-4 relative overflow-hidden
|
class="text-white rounded-3xl shadow-md p-4 relative overflow-hidden
|
||||||
lg:w-56 lg:h-56
|
lg:w-56 lg:h-56
|
||||||
sm:w-48 sm:h-48
|
sm:w-48 sm:h-48
|
||||||
|
14
components/Emoji.tsx
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { asset } from "$fresh/runtime.ts";
|
||||||
|
|
||||||
|
export const Emoji = (props: { class?: string; name: string }) => {
|
||||||
|
return props.name
|
||||||
|
? props.name.endsWith(".png")
|
||||||
|
? (
|
||||||
|
<img
|
||||||
|
class={`${props?.class || ""}`}
|
||||||
|
src={asset(`/emojis/${props.name}`)}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
: <span>{props.name}</span>
|
||||||
|
: <></>;
|
||||||
|
};
|
@ -4,6 +4,7 @@ import { CSS, KATEX_CSS } from "https://deno.land/x/gfm@0.2.5/mod.ts";
|
|||||||
import { Head } from "$fresh/runtime.ts";
|
import { Head } from "$fresh/runtime.ts";
|
||||||
import Search, { RedirectSearchHandler } from "@islands/Search.tsx";
|
import Search, { RedirectSearchHandler } from "@islands/Search.tsx";
|
||||||
import { KMenu } from "@islands/KMenu.tsx";
|
import { KMenu } from "@islands/KMenu.tsx";
|
||||||
|
import { Emoji } from "@components/Emoji.tsx";
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
children: ComponentChildren;
|
children: ComponentChildren;
|
||||||
@ -34,11 +35,11 @@ export const MainLayout = ({ children, url, title, context }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={m.link}
|
href={m.link}
|
||||||
class={`block ${
|
class={`flex items-center gap-2 ${
|
||||||
m.link === url.pathname ? "bg-white text-black" : "text-white"
|
m.link === url.pathname ? "bg-white text-black" : "text-white"
|
||||||
} p-3 text-xl w-full rounded-2xl`}
|
} p-3 text-xl w-full rounded-2xl`}
|
||||||
>
|
>
|
||||||
{m.emoji} {m.name}
|
{<Emoji class="w-6 h-6" name={m.emoji} />} {m.name}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
@ -10,6 +10,7 @@ import Checkbox from "@components/Checkbox.tsx";
|
|||||||
import { Rating } from "@components/Rating.tsx";
|
import { Rating } from "@components/Rating.tsx";
|
||||||
import { useSignal } from "@preact/signals";
|
import { useSignal } from "@preact/signals";
|
||||||
import Image from "@components/Image.tsx";
|
import Image from "@components/Image.tsx";
|
||||||
|
import { Emoji } from "@components/Emoji.tsx";
|
||||||
|
|
||||||
export const RedirectSearchHandler = () => {
|
export const RedirectSearchHandler = () => {
|
||||||
useEventListener("keydown", (e: KeyboardEvent) => {
|
useEventListener("keydown", (e: KeyboardEvent) => {
|
||||||
@ -53,8 +54,11 @@ export const SearchResultItem = (
|
|||||||
href={href}
|
href={href}
|
||||||
class="p-2 text-white flex gap-4 items-center rounded-2xl hover:bg-gray-700"
|
class="p-2 text-white flex gap-4 items-center rounded-2xl hover:bg-gray-700"
|
||||||
>
|
>
|
||||||
|
{showEmoji && resourceType
|
||||||
|
? <Emoji class="w-7 h-7" name={resourceType.emoji} />
|
||||||
|
: ""}
|
||||||
{doc?.image && <SearchResultImage src={doc.image} />}
|
{doc?.image && <SearchResultImage src={doc.image} />}
|
||||||
{`${showEmoji && resourceType ? resourceType.emoji : ""}`} {doc?.name}
|
{doc?.name}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -179,7 +183,7 @@ const Search = (
|
|||||||
class="flex items-center gap-2 p-2 my-4 mx-3"
|
class="flex items-center gap-2 p-2 my-4 mx-3"
|
||||||
style={{ color: "#818181" }}
|
style={{ color: "#818181" }}
|
||||||
>
|
>
|
||||||
<IconGhost class="animate-hover" />
|
<Emoji class="w-8 h-8" name="Ghost.png" />
|
||||||
No Results
|
No Results
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
export const resources = {
|
export const resources = {
|
||||||
"home": {
|
"home": {
|
||||||
emoji: "🏡",
|
emoji: "House with Garden.png",
|
||||||
name: "Home",
|
name: "Home",
|
||||||
link: "/",
|
link: "/",
|
||||||
prefix: "",
|
prefix: "",
|
||||||
},
|
},
|
||||||
"recipe": {
|
"recipe": {
|
||||||
emoji: "🍽️",
|
emoji: "Fork and Knife with Plate.png",
|
||||||
name: "Recipes",
|
name: "Recipes",
|
||||||
link: "/recipes",
|
link: "/recipes",
|
||||||
prefix: "Recipes/",
|
prefix: "Recipes/",
|
||||||
},
|
},
|
||||||
"movie": {
|
"movie": {
|
||||||
emoji: "🍿",
|
emoji: "Popcorn.png",
|
||||||
name: "Movies",
|
name: "Movies",
|
||||||
link: "/movies",
|
link: "/movies",
|
||||||
prefix: "Media/movies/",
|
prefix: "Media/movies/",
|
||||||
},
|
},
|
||||||
"article": {
|
"article": {
|
||||||
emoji: "📝",
|
emoji: "Writing Hand Medium-Light Skin Tone.png",
|
||||||
name: "Articles",
|
name: "Articles",
|
||||||
link: "/articles",
|
link: "/articles",
|
||||||
prefix: "Media/articles/",
|
prefix: "Media/articles/",
|
||||||
},
|
},
|
||||||
"series": {
|
"series": {
|
||||||
emoji: "📺",
|
emoji: "Television.png",
|
||||||
name: "Series",
|
name: "Series",
|
||||||
link: "/series",
|
link: "/series",
|
||||||
prefix: "Media/series/",
|
prefix: "Media/series/",
|
||||||
|
@ -19,8 +19,13 @@ export default function Home(props: PageProps) {
|
|||||||
{Object.values(resources).map((m) => {
|
{Object.values(resources).map((m) => {
|
||||||
return (
|
return (
|
||||||
<Card
|
<Card
|
||||||
title={`${m.emoji} ${m.name}`}
|
title={`${m.name}`}
|
||||||
image="/placeholder.svg"
|
backgroundSize={80}
|
||||||
|
image={`${
|
||||||
|
m.emoji.endsWith(".png")
|
||||||
|
? `/emojis/${encodeURIComponent(m.emoji)}`
|
||||||
|
: "/placeholder.svg"
|
||||||
|
}`}
|
||||||
link={m.link}
|
link={m.link}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
BIN
static/emojis/Bookmark Tabs.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
static/emojis/Crystal Ball.png
Executable file
After Width: | Height: | Size: 751 KiB |
BIN
static/emojis/Fork and Knife with Plate.png
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
static/emojis/Ghost.png
Executable file
After Width: | Height: | Size: 1.0 MiB |
BIN
static/emojis/Hourglass Done.png
Executable file
After Width: | Height: | Size: 758 KiB |
BIN
static/emojis/Hourglass Not Done.png
Executable file
After Width: | Height: | Size: 757 KiB |
BIN
static/emojis/House with Garden.png
Executable file
After Width: | Height: | Size: 12 KiB |
BIN
static/emojis/Musical Note.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
static/emojis/Musical Notes.png
Executable file
After Width: | Height: | Size: 958 KiB |
BIN
static/emojis/Paperclip.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
static/emojis/Party Popper.png
Executable file
After Width: | Height: | Size: 528 KiB |
BIN
static/emojis/Popcorn.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
static/emojis/Rocket.png
Executable file
After Width: | Height: | Size: 850 KiB |
BIN
static/emojis/Teddy Bear.png
Executable file
After Width: | Height: | Size: 1.1 MiB |
BIN
static/emojis/Television.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
static/emojis/Writing Hand Medium-Light Skin Tone.png
Executable file
After Width: | Height: | Size: 936 KiB |
BIN
static/emojis/placeholder.png
Executable file
After Width: | Height: | Size: 36 KiB |