w3ui icon indicating copy to clipboard operation
w3ui copied to clipboard

CID component

Open 2color opened this issue 2 years ago • 1 comments

Any app that makes use of IPFS is likely to render CIDs.

I was thinking it would be nice to create a CID component that has the following features:

  • Can render a short version of the CID, e.g. bafy...hmfm
  • Copy to clipboard
  • Link to gateway(s)

Have youse considered anything like this?

2color avatar Oct 13 '22 14:10 2color

This is a great idea. I started something similar in my repo: https://github.com/codyzu/ipfs-drive/blob/main/src/cid.jsx

I would be happy to contribute a PR. The stickler here is that my component uses CSS to dynamically show the short version (with ellipses).

I'm wondering if this is a reasonable component for w3ui since IMO it would be heavily dependent on the styling used (I'm also imagining the copy to clipboard visual feedback, i.e. "copied").

My component uses unocss (roughly equivalent to windi or tailwind). I wondering if there would really be much value in a "generic" component that does this without styling. 🤔

codyzu avatar Oct 26 '22 12:10 codyzu