-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(taxonomy-editor-frontend): Create a component for nodes table (
#290) refactor(taxonomy-editor-frontend):create a component for nodes table used in nodes and search pages Co-authored-by: alice.juan <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
42 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
taxonomy-editor-frontend/src/components/NodesTableBody.tsx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { | ||
IconButton, | ||
TableBody, | ||
TableCell, | ||
TableRow, | ||
Typography, | ||
} from "@mui/material"; | ||
import EditIcon from "@mui/icons-material/Edit"; | ||
import { Link } from "react-router-dom"; | ||
|
||
type Props = { | ||
nodeIds: string[]; | ||
taxonomyName: string; | ||
branchName: string; | ||
}; | ||
|
||
const NodesTableBody = ({ nodeIds, taxonomyName, branchName }: Props) => { | ||
return ( | ||
<> | ||
<TableBody> | ||
{nodeIds.map((nodeId) => ( | ||
<TableRow key={nodeId}> | ||
<TableCell align="left" component="td" scope="row"> | ||
<Typography variant="subtitle1">{nodeId}</Typography> | ||
</TableCell> | ||
<TableCell align="left" component="td" scope="row"> | ||
<IconButton | ||
component={Link} | ||
to={`/${taxonomyName}/${branchName}/entry/${nodeId}`} | ||
aria-label="edit" | ||
> | ||
<EditIcon color="primary" /> | ||
</IconButton> | ||
</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</> | ||
); | ||
}; | ||
|
||
export default NodesTableBody; |
This file contains 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
This file contains 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