Skip to content

Instantly share code, notes, and snippets.

View colepeters's full-sized avatar

Cole Peters colepeters

View GitHub Profile
@colepeters
colepeters / index.html
Last active May 21, 2024 19:32
Example of a custom element to prefetch a link's `href`
<prefetched-link href="https://prefetch-this-href.example.org">
This link's href is prefetched if the user is on a fast network
</prefetched-link>
@colepeters
colepeters / enhance-breadcrumbs.mjs
Last active April 4, 2024 18:30
Quick example of building a single Breadcrumbs component which takes it data from the store and returns accessible, valid markup
// app/elements/enhance-breadcrumbs.mjs
export default function EnhanceBreadcrumbs ({ html, state }) {
const { store } = state
const { breadcrumbs } = store
const items = breadcrumbs.map(b => `
<li>
<a href="${b.href}">
${b.label}
</a>

Keybase proof

I hereby claim:

  • I am colepeters on github.
  • I am cole (https://keybase.io/cole) on keybase.
  • I have a public key whose fingerprint is 0935 C978 8092 3F6F 2231 D1C1 DBD3 AD2C 6A91 A1A0

To claim this, I am signing this object: