ricokahler / sanity-super-pane

The Sanity Desk Tool Pane with Super Powers
sanity-super-pane.vercel.app
MIT License
101 stars 12 forks source link

feat: add support for custom column and cells in table #32

Closed Jesperpaulsen closed 1 year ago

Jesperpaulsen commented 3 years ago

This PR introduces custom columns/cells.

With this PR it's possible to define custom columns. It's also possible to add a custom component for the cell. If no component has been provided, it will fall back to the standard component for that field type.

The structure for a field have been updated to:

const customColumns = [
  {
    title: 'Title 2',
    name: 'title2',
    type: 'string',
    query: "title"
  },
  {
    title: 'Cast Members',
    name: 'castMembers',
    type: 'number',
    query: "count(castMembers)",
    component: ({ castMembers }) => <div style={{ color: 'green' }}>{castMembers}</div>
  }
]

export default () =>
  S.list()
    .title('Base')
    .items([
      S.listItem().title('Normal List').child(createSuperPane('movie', S, customColumns)),
    ]);
vercel[bot] commented 3 years ago

Someone is attempting to deploy a commit to a Personal Account owned by @ricokahler on Vercel.

@ricokahler first needs to authorize it.

Jesperpaulsen commented 1 year ago

Closing this for now. I'm now longer maintaining the repo the PR was opened from, and the changes this PR introduces is probably to big to be implemented now.