Skip to content

Commit

Permalink
Allow multiple patterns per question (#22)
Browse files Browse the repository at this point in the history
* Allow multiple patterns per question

Fixes #10

* Convert pattern field to array

This update will allow multiple patterns to be added per question.

* Update Pattern column cell render to support multiple patterns
  • Loading branch information
Sean committed Jun 6, 2020
1 parent 5423f06 commit 2a91f1b
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 183 deletions.
17 changes: 14 additions & 3 deletions src/components/Table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,20 @@ const Table = () => {
{
Header: 'Pattern',
accessor: 'pattern',
Cell: cellInfo => {
const patterns = `${cellInfo.row.original.pattern}`
.split(',')
.map(pattern => {
return (
<Badge key={pattern} className={pattern} pill>
{pattern}
</Badge>
);
});

return <Row className="patterns">{patterns}</Row>;
},

Filter: SelectColumnFilter,
},
{
Expand Down Expand Up @@ -172,9 +186,6 @@ const Table = () => {
columns,
data,
defaultColumn,
initialState: {
sortBy: [{ id: 'pattern' }],
},
},
useFilters,
useSortBy,
Expand Down
3 changes: 2 additions & 1 deletion src/components/Table/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
background-color: #d9534f;
}

.companies {
.companies,
.patterns {
justify-content: space-evenly;
margin: 0;
}
Expand Down
Loading

0 comments on commit 2a91f1b

Please sign in to comment.