Skip to content

Commit

Permalink
feat(table)!: no results prop & slot is renamed to no data
Browse files Browse the repository at this point in the history
  • Loading branch information
jd-solanki committed Dec 16, 2022
1 parent c7c084e commit 9b34fc2
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions packages/anu-vue/src/components/table/ATable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const tableProps = {
/**
* Text to render when no row is available
*/
noResultsText: {
noDataText: {
type: String,
default: 'No matching results found!!',
},
Expand Down Expand Up @@ -348,17 +348,16 @@ export const ATable = defineComponent({
})

return () => {
// TODO: There should be no data as well and it should be rendered only when data is filtered and there's no resulting rows
// 👉 No results
const noResultsTr = <tr>
// 👉 No Data
const noDataTr = <tr>
<td
class="em:px-[1.15rem] em:h-14 whitespace-nowrap text-center font-medium"
colspan={_columns.value.length}
>
{slots.noResults
? slots.noResults()
{slots['no-data']
? slots['no-data']()
: <span>
{props.noResultsText}
{props.noDataText}
</span>}
</td>
</tr>
Expand All @@ -368,8 +367,6 @@ export const ATable = defineComponent({
text via default text just above the table
Later on, we will merge both default slots and will pass as single slot content to card
TODO(refactor): Use variant group here
*/
const table = <div class="overflow-x-auto">
<table class="a-table-table overflow-x-auto w-full max-w-full">
Expand Down Expand Up @@ -432,7 +429,7 @@ export const ATable = defineComponent({
}
</tr>
})
: noResultsTr
: noDataTr
}
</tbody>
</table>
Expand Down

0 comments on commit 9b34fc2

Please sign in to comment.