-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create DirectoryInformation component with docs
- Loading branch information
Justin Campbell
committed
Oct 12, 2020
1 parent
29a5340
commit e503d26
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/components/DirectoryInformation/DirectoryInformation.js
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import React from "react"; | ||
| import PropTypes from "prop-types"; | ||
| import { TableContainer, Table, TableRow, TableCell, makeStyles } from "@material-ui/core"; | ||
|
|
||
| export default function DirectoryInformation({ section }) { | ||
|
|
||
| const useStyles = makeStyles(() => ({ | ||
| breakWord: { | ||
| wordBreak: "break-word", | ||
| } | ||
| })); | ||
| const classes = useStyles(); | ||
|
|
||
| return ( | ||
| <TableContainer> | ||
| <Table size="small" > | ||
| {Object.keys(section).map((key) => ( | ||
| key === "type" ? "" : | ||
| <TableRow> | ||
| <TableCell variant="head">{key}</TableCell> | ||
| <TableCell classes={{ root: classes.breakWord }}>{section[key]}</TableCell> | ||
| </TableRow> | ||
| ))} | ||
| </Table> | ||
| </TableContainer> | ||
| ); | ||
| }; | ||
|
|
||
| DirectoryInformation.propTypes = { | ||
| /** The object containing directory information. */ | ||
| "section": PropTypes.object | ||
| }; | ||
|
|
||
| DirectoryInformation.defaultProps = { | ||
| "section": {} | ||
| }; |
31 changes: 31 additions & 0 deletions
31
src/components/DirectoryInformation/DirectoryInformation.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| Displays the directory information as a table. | ||
|
|
||
|
|
||
| ```jsx | ||
| import { Paper } from "@material-ui/core"; | ||
| import DirectoryInformation from "./DirectoryInformation"; | ||
|
|
||
| const example_directory_data = { | ||
| "type": "directory_information", | ||
| "Name": "Heyi Feng", | ||
| "Login": "feng293", | ||
| "Computer": "civil4147pc2.ecn", | ||
| "Location": "HAMP 4147", | ||
| "Email": "feng293@purdue.edu", | ||
| "Phone": "5039154835", | ||
| "Office": "", | ||
| "UNIX Dir": "None", | ||
| "Zero Dir": "U=\\\\myhome.itap.purdue.edu\\myhome\\%username%", | ||
| "User ECNDB": "http://eng.purdue.edu/jump/2e29495", | ||
| "Host ECNDB": "http://eng.purdue.edu/jump/2eccc3f", | ||
| "Subject": "Upgrade system and Abaqus" | ||
| }; | ||
|
|
||
| <Paper> | ||
| <DirectoryInformation section={example_directory_data} /> | ||
| </Paper> | ||
| ``` | ||
|
|
||
| ```jsx static | ||
| <DirectoryInformation section={example_directory_data} /> | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from "./DirectoryInformation"; |