Created
February 26, 2020 08:28
-
-
Save gregberge/41627ea41d24139d6d616ea71ecc8bd5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Specification of the List component | |
// This complete example describe the API of the component | |
// It has to be implemented to work with this API | |
function ListExample() { | |
const list = useListState({ | |
columns: { | |
name: { | |
props: { | |
col: 'auto', | |
width: 200, | |
}, | |
}, | |
description: { | |
props: { | |
col: 1, | |
}, | |
}, | |
}, | |
}) | |
return ( | |
<List {...list}> | |
<ListHeader {...list}> | |
<ListHeaderCell {...list} colId="name" /> | |
<ListHeaderCell {...list} colId="description" /> | |
</ListHeader> | |
<ListRow {...list}> | |
<ListRowCell {...list} colId="name"> | |
Apple | |
</ListRowCell> | |
<ListRowCell {...list} colId="description"> | |
A red fruit | |
</ListRowCell> | |
</ListRow> | |
<ListRow {...list}> | |
<ListRowCell {...list} colId="name"> | |
Banana | |
</ListRowCell> | |
<ListRowCell {...list} colId="description"> | |
A yellow fruit | |
</ListRowCell> | |
</ListRow> | |
</List> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment