|
| 1 | +/* ============================================================================ |
| 2 | + * Copyright (c) Palo Alto Networks |
| 3 | + * |
| 4 | + * This source code is licensed under the MIT license found in the |
| 5 | + * LICENSE file in the root directory of this source tree. |
| 6 | + * ========================================================================== */ |
| 7 | + |
| 8 | +/* ============================================================================ |
| 9 | + * Copyright (c) Palo Alto Networks |
| 10 | + * |
| 11 | + * This source code is licensed under the MIT license found in the |
| 12 | + * LICENSE file in the root directory of this source tree. |
| 13 | + * ========================================================================== */ |
| 14 | + |
| 15 | +import React from "react"; |
| 16 | + |
| 17 | +interface ParamDetailsProps { |
| 18 | + paramType: string; |
| 19 | + params: Array<{ |
| 20 | + field: string; |
| 21 | + required?: boolean; |
| 22 | + description?: string; |
| 23 | + type?: string; |
| 24 | + }>; |
| 25 | +} |
| 26 | + |
| 27 | +export default function ParamDetails({ paramType, params }: ParamDetailsProps) { |
| 28 | + if (!params || params.length === 0) { |
| 29 | + return null; |
| 30 | + } |
| 31 | + |
| 32 | + return ( |
| 33 | + <div style={{ margin: "16px 0" }}> |
| 34 | + <h3>{paramType} Parameters</h3> |
| 35 | + <table style={{ width: "100%", borderCollapse: "collapse" }}> |
| 36 | + <thead> |
| 37 | + <tr style={{ backgroundColor: "#f8f9fa" }}> |
| 38 | + <th |
| 39 | + style={{ |
| 40 | + padding: "8px", |
| 41 | + border: "1px solid #ddd", |
| 42 | + textAlign: "left", |
| 43 | + }} |
| 44 | + > |
| 45 | + Name |
| 46 | + </th> |
| 47 | + <th |
| 48 | + style={{ |
| 49 | + padding: "8px", |
| 50 | + border: "1px solid #ddd", |
| 51 | + textAlign: "left", |
| 52 | + }} |
| 53 | + > |
| 54 | + Type |
| 55 | + </th> |
| 56 | + <th |
| 57 | + style={{ |
| 58 | + padding: "8px", |
| 59 | + border: "1px solid #ddd", |
| 60 | + textAlign: "left", |
| 61 | + }} |
| 62 | + > |
| 63 | + Required |
| 64 | + </th> |
| 65 | + <th |
| 66 | + style={{ |
| 67 | + padding: "8px", |
| 68 | + border: "1px solid #ddd", |
| 69 | + textAlign: "left", |
| 70 | + }} |
| 71 | + > |
| 72 | + Description |
| 73 | + </th> |
| 74 | + </tr> |
| 75 | + </thead> |
| 76 | + <tbody> |
| 77 | + {params.map((param, index) => ( |
| 78 | + <tr key={index}> |
| 79 | + <td style={{ padding: "8px", border: "1px solid #ddd" }}> |
| 80 | + <code>{param.field}</code> |
| 81 | + </td> |
| 82 | + <td style={{ padding: "8px", border: "1px solid #ddd" }}> |
| 83 | + {param.type || "string"} |
| 84 | + </td> |
| 85 | + <td style={{ padding: "8px", border: "1px solid #ddd" }}> |
| 86 | + {param.required ? "✓" : ""} |
| 87 | + </td> |
| 88 | + <td style={{ padding: "8px", border: "1px solid #ddd" }}> |
| 89 | + {param.description || ""} |
| 90 | + </td> |
| 91 | + </tr> |
| 92 | + ))} |
| 93 | + </tbody> |
| 94 | + </table> |
| 95 | + </div> |
| 96 | + ); |
| 97 | +} |
0 commit comments