blob: 7246663bd76d496600c37980ce13d3a7b011b852 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import React from "react";
interface ClassPropertyRefProps {
name: string;
details: string;
required: boolean;
default: string;
}
const PYTHON_TYPES = {
string: "str",
integer: "int",
};
export default function ClassPropertyRef(props: ClassPropertyRefProps) {
const details = JSON.parse(props.details);
return (
<>
<div>
<h4 style={{ display: "inline-block", marginRight: "10px" }}>
{props.name}
</h4>
{props.required && (
<span
style={{
color: "red",
fontSize: "11px",
marginRight: "4px",
borderRadius: "4px",
border: "1px solid red",
padding: "1px 2px",
}}
>
REQUIRED
</span>
)}
<span>
{details.type && `(${PYTHON_TYPES[details.type] || details.type})`}
</span>
{props.default && (
<span>
{" "}
= {details.type === "string" && '"'}
{props.default}
{details.type === "string" && '"'}
</span>
)}
</div>
<p>{details.description}</p>
</>
);
}
|