updates DocStringComponent placement

This commit is contained in:
Mose Müller 2024-01-16 12:55:18 +01:00
parent 0343abd0b0
commit 0e9832e2f1
10 changed files with 32 additions and 21 deletions

View File

@ -102,14 +102,12 @@ export const AsyncMethodComponent = React.memo((props: AsyncMethodProps) => {
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<h5> <h5>Function: {displayName}</h5>
Function: {displayName}
<DocStringComponent docString={docString} />
</h5>
<Form onSubmit={execute} ref={formRef}> <Form onSubmit={execute} ref={formRef}>
{args} {args}
<Button id={`button-${id}`} name={name} value={parentPath} type="submit"> <Button id={`button-${id}`} name={name} value={parentPath} type="submit">
{runningTask ? 'Stop ' : 'Start '} {runningTask ? 'Stop ' : 'Start '}
<DocStringComponent docString={docString} />
</Button> </Button>
</Form> </Form>
</div> </div>

View File

@ -48,7 +48,6 @@ export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<ToggleButton <ToggleButton
id={`toggle-check-${id}`} id={`toggle-check-${id}`}
type="checkbox" type="checkbox"
@ -58,6 +57,7 @@ export const ButtonComponent = React.memo((props: ButtonComponentProps) => {
disabled={readOnly} disabled={readOnly}
onChange={(e) => setChecked(e.currentTarget.checked)}> onChange={(e) => setChecked(e.currentTarget.checked)}>
{displayName} {displayName}
<DocStringComponent docString={docString} />
</ToggleButton> </ToggleButton>
</div> </div>
); );

View File

@ -53,10 +53,12 @@ export const ColouredEnumComponent = React.memo((props: ColouredEnumComponentPro
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<Row> <Row>
<Col className="d-flex align-items-center"> <Col className="d-flex align-items-center">
<InputGroup.Text>{displayName}</InputGroup.Text> <InputGroup.Text>
{displayName}
<DocStringComponent docString={docString} />
</InputGroup.Text>
{readOnly ? ( {readOnly ? (
// Display the Form.Control when readOnly is true // Display the Form.Control when readOnly is true
<Form.Control <Form.Control

View File

@ -52,10 +52,12 @@ export const EnumComponent = React.memo((props: EnumComponentProps) => {
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<Row> <Row>
<Col className="d-flex align-items-center"> <Col className="d-flex align-items-center">
<InputGroup.Text>{displayName}</InputGroup.Text> <InputGroup.Text>
{displayName}
<DocStringComponent docString={docString} />
</InputGroup.Text>
<Form.Select <Form.Select
aria-label="Default select example" aria-label="Default select example"
value={value} value={value}

View File

@ -95,7 +95,7 @@ export const GenericComponent = React.memo(
<SliderComponent <SliderComponent
name={name} name={name}
parentPath={parentPath} parentPath={parentPath}
docString={attribute.doc} docString={attribute.value['value'].doc}
readOnly={attribute.readonly} readOnly={attribute.readonly}
value={attribute.value['value']} value={attribute.value['value']}
min={attribute.value['min']} min={attribute.value['min']}
@ -179,7 +179,7 @@ export const GenericComponent = React.memo(
parentPath={parentPath} parentPath={parentPath}
value={attribute.value['value']['value'] as string} value={attribute.value['value']['value'] as string}
readOnly={attribute.readonly} readOnly={attribute.readonly}
docString={attribute.doc} docString={attribute.value['value'].doc}
// Add any other specific props for the ImageComponent here // Add any other specific props for the ImageComponent here
format={attribute.value['format']['value'] as string} format={attribute.value['format']['value'] as string}
addNotification={addNotification} addNotification={addNotification}

View File

@ -48,14 +48,15 @@ export const ImageComponent = React.memo((props: ImageComponentProps) => {
onClick={() => setOpen(!open)} onClick={() => setOpen(!open)}
style={{ cursor: 'pointer' }} // Change cursor style on hover style={{ cursor: 'pointer' }} // Change cursor style on hover
> >
{displayName} {open ? <ChevronDown /> : <ChevronRight />} {displayName}
<DocStringComponent docString={docString} />
{open ? <ChevronDown /> : <ChevronRight />}
</Card.Header> </Card.Header>
<Collapse in={open}> <Collapse in={open}>
<Card.Body> <Card.Body>
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<p>Render count: {renderCount.current}</p> <p>Render count: {renderCount.current}</p>
)} )}
<DocStringComponent docString={docString} />
{/* Your component JSX here */} {/* Your component JSX here */}
{format === '' && value === '' ? ( {format === '' && value === '' ? (
<p>No image set in the backend.</p> <p>No image set in the backend.</p>

View File

@ -89,12 +89,12 @@ export const MethodComponent = React.memo((props: MethodProps) => {
)} )}
<h5 onClick={() => setHideOutput(!hideOutput)} style={{ cursor: 'pointer' }}> <h5 onClick={() => setHideOutput(!hideOutput)} style={{ cursor: 'pointer' }}>
Function: {displayName} Function: {displayName}
<DocStringComponent docString={docString} />
</h5> </h5>
<Form onSubmit={execute}> <Form onSubmit={execute}>
{args} {args}
<Button variant="primary" type="submit"> <Button variant="primary" type="submit">
Execute Execute
<DocStringComponent docString={docString} />
</Button> </Button>
</Form> </Form>

View File

@ -313,10 +313,14 @@ export const NumberComponent = React.memo((props: NumberComponentProps) => {
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<div className="d-flex"> <div className="d-flex">
<InputGroup> <InputGroup>
{showName && <InputGroup.Text>{displayName}</InputGroup.Text>} {showName && (
<InputGroup.Text>
{displayName}
<DocStringComponent docString={docString} />
</InputGroup.Text>
)}
<Form.Control <Form.Control
type="text" type="text"
value={inputString} value={inputString}

View File

@ -105,10 +105,12 @@ export const SliderComponent = React.memo((props: SliderComponentProps) => {
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<Row> <Row>
<Col xs="auto" xl="auto"> <Col xs="auto" xl="auto">
<InputGroup.Text>{displayName}</InputGroup.Text> <InputGroup.Text>
{displayName}
<DocStringComponent docString={docString} />
</InputGroup.Text>
</Col> </Col>
<Col xs="5" xl> <Col xs="5" xl>
<Slider <Slider

View File

@ -70,9 +70,11 @@ export const StringComponent = React.memo((props: StringComponentProps) => {
{process.env.NODE_ENV === 'development' && ( {process.env.NODE_ENV === 'development' && (
<div>Render count: {renderCount.current}</div> <div>Render count: {renderCount.current}</div>
)} )}
<DocStringComponent docString={docString} />
<InputGroup> <InputGroup>
<InputGroup.Text>{displayName}</InputGroup.Text> <InputGroup.Text>
{displayName}
<DocStringComponent docString={docString} />
</InputGroup.Text>
<Form.Control <Form.Control
type="text" type="text"
value={inputString} value={inputString}