Skip to content

Commit

Permalink
fix(ui): table should have a header and body group
Browse files Browse the repository at this point in the history
  • Loading branch information
mvegter committed May 17, 2020
1 parent ba04766 commit 101a0fa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/public/components/Table/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const row = (value, text) => {
*/
const content = (data, keys, params) => {
const idKey = Object.keys(keys).find((key) => keys[key] && keys[key].primary);
return data.map((entry) =>
h(`tr#row${entry[idKey]}`, params(entry), Object.entries(keys).map(([key, value]) => row(value, entry[key]))));
return h('tbody', data.map((entry) =>
h(`tr#row${entry[idKey]}`, params(entry), Object.entries(keys).map(([key, value]) => row(value, entry[key])))));
};

export default content;
9 changes: 4 additions & 5 deletions lib/public/components/Table/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import { h } from '/js/src/index.js';
* @param {Object} keys The full collection of API keys and their corresponding header values
* @return {vnode} An array of rows containing all given header values with specific cell sizes
*/
const headers = (keys) =>
h('tr#headers', Object.values(keys).map((value) => {
const size = value.size || 'cell-m';
return h(`th.${size}`, value.name);
}));
const headers = (keys) => h('thead', h('tr', Object.values(keys).map((value) => {
const size = value.size || 'cell-m';
return h(`th.${size}`, { scope: 'col' }, value.name);
})));

export default headers;

0 comments on commit 101a0fa

Please sign in to comment.