open-ui icon indicating copy to clipboard operation
open-ui copied to clipboard

Multiple URLs for components?

Open GarthDB opened this issue 3 months ago • 0 comments

I'm working on a PR to update Spectrum. We have multiple implementations and corresponding websites, and it would be nice to add them to the data. I think this is related to #1017, but it could provide a real-world example by showing how I'd like to add the data.

Currently, the data in the repo looks like this:

"name": "Menu",
"url": "https://react-spectrum.adobe.com/react-spectrum/Menu.html",

This is a great start, but this URL points to only the React implementation of this component when we have other implementations and the design definition.

I'd like to propose turning the url string into a urls array of objects with name and URL strings, like this:

"name": "Menu",
"urls": [
  {
    "name": "Spectrum Design",
    "url": "https://spectrum.adobe.com/page/menu/"
  },
  {
    "name": "React Spectrum",
    "url": "https://react-spectrum.adobe.com/react-spectrum/Menu.html"
  },
  {
    "name": "Spectrum Web Components",
    "url": "https://opensource.adobe.com/spectrum-web-components/components/menu/"
  }
]

This doesn't have to be a breaking change for existing data; we could leave the url property in the component definition and add urls.

Trying to think through implications, we could leave the url property as required to make sure the component pages with links still render the same, or we could update the definition to use either the url property or the first object in the urls array if it exists.

I'm happy to put together a PR if this could help.

GarthDB avatar Mar 28 '24 17:03 GarthDB