docs: updating Adding_Components description

This commit is contained in:
Mose Müller 2023-10-30 14:16:39 +01:00
parent 743531c434
commit b6c956fab8

View File

@ -113,6 +113,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { Card, Collapse, Image } from 'react-bootstrap'; import { Card, Collapse, Image } from 'react-bootstrap';
import { DocStringComponent } from './DocStringComponent'; import { DocStringComponent } from './DocStringComponent';
import { ChevronDown, ChevronRight } from 'react-bootstrap-icons'; import { ChevronDown, ChevronRight } from 'react-bootstrap-icons';
import { getIdFromFullAccessPath } from '../utils/stringUtils';
interface ImageComponentProps { interface ImageComponentProps {
name: string; name: string;
@ -130,6 +131,8 @@ export const ImageComponent = React.memo((props: ImageComponentProps) => {
const renderCount = useRef(0); const renderCount = useRef(0);
const [open, setOpen] = useState(true); // add this if you want to expand/collapse your component const [open, setOpen] = useState(true); // add this if you want to expand/collapse your component
const fullAccessPath = parentPath.concat('.' + name);
const id = getIdFromFullAccessPath(fullAccessPath);
useEffect(() => { useEffect(() => {
renderCount.current++; renderCount.current++;
@ -143,7 +146,7 @@ export const ImageComponent = React.memo((props: ImageComponentProps) => {
// Your component logic here // Your component logic here
return ( return (
<div className={'imageComponent'} id={parentPath.concat('.' + name)}> <div className={'imageComponent'} id={id}>
{/* Add the Card and Collapse components here if you want to be able to expand and {/* Add the Card and Collapse components here if you want to be able to expand and
collapse your component. */} collapse your component. */}
<Card> <Card>
@ -296,4 +299,4 @@ However, you might want to use the `addNotification` at different places. For an
Test the frontend component to ensure that it renders correctly and interacts seamlessly Test the frontend component to ensure that it renders correctly and interacts seamlessly
with the backend. Consider writing unit tests using a testing library like Jest or React with the backend. Consider writing unit tests using a testing library like Jest or React
Testing Library, and manually test the component in the browser. Testing Library, and manually test the component in the browser.