mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-06-29 23:45:58 -04:00
clean up self-hosted emoji code
This commit is contained in:
+10
-3
@@ -1,4 +1,11 @@
|
||||
import { parse as parseEmoji } from "imagemoji";
|
||||
import * as imagemoji from "imagemoji";
|
||||
|
||||
// we're hosting twemojis locally instead of from Twitter's CDN
|
||||
parseEmoji(document.body, (icon) => `/assets/emoji/${icon}.svg`);
|
||||
const parseEmoji = (what) =>
|
||||
// we're hosting twemojis locally instead of from Twitter's CDN
|
||||
imagemoji.parse(what, (icon) => `/assets/emoji/${icon}.svg`);
|
||||
|
||||
// apply to the entire body automatically on load...
|
||||
parseEmoji(document.body);
|
||||
|
||||
// ...but this can still be reused elsewhere so the URL above doesn't need to be changed in multiple places
|
||||
export default parseEmoji;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { h, render, Fragment } from "preact";
|
||||
import { useState, useEffect } from "preact/hooks";
|
||||
import fetch from "unfetch";
|
||||
import { parse as parseEmoji } from "imagemoji";
|
||||
import dayjs from "dayjs";
|
||||
import dayjsRelativeTime from "dayjs/plugin/relativeTime.js";
|
||||
import parseEmoji from "./emoji.js";
|
||||
|
||||
// shared react components:
|
||||
import { StarIcon, RepoForkedIcon } from "@primer/octicons-react";
|
||||
@@ -48,7 +48,7 @@ const RepositoryCard = (repo) => (
|
||||
<p
|
||||
class="repo-description"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: parseEmoji(repo.description, (icon) => `/assets/emoji/${icon}.svg`) }}
|
||||
dangerouslySetInnerHTML={{ __html: parseEmoji(repo.description) }}
|
||||
/>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user