Skip to content

Commit 9993db6

Browse files
authored
Export defaultRemoveCell separately (#48)
This allows us to get hold of `defaultRemoveCell` without incurring an `Eq row` constraint.
1 parent cce62df commit 9993db6

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/Lumi/Components/EditableTable.purs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,22 @@ editableTableDefaults =
4545
, onRowAdd: pure unit
4646
, onRowRemove: \_ -> pure unit
4747
, readonly: false
48-
, removeCell
48+
, removeCell: defaultRemoveCell
4949
, rows: Left []
5050
, rowEq: eq
5151
, summary: empty
5252
}
53-
where
54-
removeCell onRowRemove item =
55-
onRowRemove # Array.foldMap \onRowRemove' ->
56-
R.a
57-
{ children: [ icon_ Bin ]
58-
, className: "lumi"
59-
, onClick: capture_ $ onRowRemove' item
60-
, role: "button"
61-
, style: R.css { fontSize: "20px", lineHeight: "20px", textDecoration: "none" }
62-
}
53+
54+
defaultRemoveCell :: forall row. Maybe (row -> Effect Unit) -> row -> JSX
55+
defaultRemoveCell onRowRemove item =
56+
onRowRemove # Array.foldMap \onRowRemove' ->
57+
R.a
58+
{ children: [ icon_ Bin ]
59+
, className: "lumi"
60+
, onClick: capture_ $ onRowRemove' item
61+
, role: "button"
62+
, style: R.css { fontSize: "20px", lineHeight: "20px", textDecoration: "none" }
63+
}
6364

6465
component :: forall row. Component (EditableTableProps row)
6566
component = createComponent "EditableTableExample"

0 commit comments

Comments
 (0)