carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.85k stars 1.81k forks source link

Update DataTableSkeleton's headers prop to match DataTable's headers prop #13246

Open cknabe opened 1 year ago

cknabe commented 1 year ago

Found while working to add TS types for DataTableSkeleton: https://github.com/carbon-design-system/carbon/issues/12516

The DataTable propType for headers is:

    headers: PropTypes.arrayOf(
      PropTypes.shape({
        key: PropTypes.string.isRequired,
        header: PropTypes.node.isRequired,
      })
    ).isRequired,

The DataTableSkeleton propType for headers is:

  headers: PropTypes.oneOfType([
    PropTypes.array,
    PropTypes.shape({
      key: PropTypes.string,
    }),
  ]),

DataTableSkeleton's usage of headers:

                {headers ? (
                  <div className="bx--table-header-label">
                    {headers[i]?.header}
                  </div>
                ) : (
                  <span/>
                )}
tay1orjones commented 1 year ago

Yes, thanks for opening this issue. We'll slate to tackle it in v12 due to it needing a breaking change.