From 86109dcfd008baf8778cc221cc25f90dd77121e9 Mon Sep 17 00:00:00 2001
From: Jarred Sumner <jarred@jarredsumner.com>
Date: Mon, 27 Sep 2021 01:33:15 -0700
Subject: Add a few macros examples

---
 examples/macros/components/example.jsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 examples/macros/components/example.jsx

(limited to 'examples/macros/components/example.jsx')

diff --git a/examples/macros/components/example.jsx b/examples/macros/components/example.jsx
new file mode 100644
index 000000000..ad80ce9e1
--- /dev/null
+++ b/examples/macros/components/example.jsx
@@ -0,0 +1,17 @@
+// source code
+import { matchInFile } from "macro:matchInFile";
+
+export const IPAddresses = () => (
+  <div>
+    <h2>recent ip addresses</h2>
+    <div className="Lines">
+      {matchInFile("access.log", /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}/).map(
+        (ipAddress, index) => (
+          <div className="Line" key={index}>
+            {ipAddress}
+          </div>
+        )
+      )}
+    </div>
+  </div>
+);
-- 
cgit v1.2.3

