summaryrefslogtreecommitdiff
path: root/src/components/OpenMoji.astro
diff options
context:
space:
mode:
authorMatt Kosarek <matt.kosarek@canonical.com>2026-04-28 19:50:26 -0400
committerMatt Kosarek <matt.kosarek@canonical.com>2026-04-28 19:50:26 -0400
commitcae601b0fe048add790fa3b4341d76c973f14b2b (patch)
tree99313f7be181adcf1604e7fa8d6c583f487b1842 /src/components/OpenMoji.astro
parent5df5ae2fc3f3bcbd53a9e34ba6b8ddaf4b00036a (diff)
Publish new blog post + style changes
Diffstat (limited to 'src/components/OpenMoji.astro')
-rw-r--r--src/components/OpenMoji.astro15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/components/OpenMoji.astro b/src/components/OpenMoji.astro
new file mode 100644
index 0000000..9fd581d
--- /dev/null
+++ b/src/components/OpenMoji.astro
@@ -0,0 +1,15 @@
+---
+import { readFileSync } from 'fs';
+import { fileURLToPath } from 'url';
+import { join, dirname } from 'path';
+
+interface Props { code: string; alt: string; size?: string; }
+const { code, alt, size = '1.2em' } = Astro.props;
+
+const svgPath = join(
+ dirname(fileURLToPath(import.meta.url)),
+ `../../node_modules/openmoji/color/svg/${code}.svg`
+);
+const svg = readFileSync(svgPath, 'utf-8');
+---
+<span class="openmoji" role="img" aria-label={alt} style={`width:${size};height:${size};display:inline-flex;vertical-align:middle`} set:html={svg} />