Skip to content

Commit d289eb7

Browse files
v0.3.11 (#48)
feat(AnnotationEngine) add children content
1 parent 33d5058 commit d289eb7

4 files changed

Lines changed: 29 additions & 2 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@thetribe/react-components",
3-
"version": "0.3.10",
3+
"version": "0.3.11",
44
"description": "Library of generic React components",
55
"main": "dist/bundle.js",
66
"types": "dist/index.d.ts",

src/annotation-engine/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Annotation, PartialAnnotationStyle, StyleDataById } from './models';
33
import Canvas from './style/canvas';
44
import Container from './style/container';
55
import Image from './style/image';
6+
import InnerContainer from './style/inner-container';
67
import useAnnotationEngine, { Handles, OnEvent } from './use-annotation-engine';
78

89
export interface AnnotationEngineProps {
@@ -31,6 +32,7 @@ const AnnotationEngine: FC<AnnotationEngineProps> = forwardRef(
3132
styleForAnnotations,
3233
styleForAnnotationToEdit,
3334
styleForPointsToEdit,
35+
children,
3436
},
3537
ref: ForwardedRef<Handles>,
3638
) => {
@@ -50,6 +52,7 @@ const AnnotationEngine: FC<AnnotationEngineProps> = forwardRef(
5052

5153
return (
5254
<Container className={className}>
55+
{children && <InnerContainer>{children}</InnerContainer>}
5356
<Image src={backgroundImagePath} />
5457
{foregroundImagePath && <Image src={foregroundImagePath} />}
5558
<Canvas ref={cRef} id={id} />

src/annotation-engine/stories.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ const Label = styled.label`
4949
color: white;
5050
`;
5151

52+
const InnerContent = styled.div`
53+
background-color: wheat;
54+
border-radius: 12px;
55+
box-sizing: content-box;
56+
color: black;
57+
height: fit-content;
58+
margin: 12px auto;
59+
padding: 10px;
60+
width: fit-content;
61+
`;
62+
5263
type SaveAnnotationFunction = (geometry: Array<Coordinates>, isClosed: boolean) => string;
5364

5465
const useSaveAnnotation = () => {
@@ -534,7 +545,9 @@ const RoadcareBehaviorTemplate: Story<StyledProps> = ({ width, height, ...args }
534545
styleForAnnotationToEdit={styleForAnnotationToEdit}
535546
styleForAnnotations={styleOps.styleForAnnotations}
536547
styleForPointsToEdit={styleOps.styleForPointsToEdit}
537-
/>
548+
>
549+
<InnerContent>Inner container</InnerContent>
550+
</StyledAnnotationEngine>
538551
<ActionContainer>
539552
<Label>Type de forme</Label>
540553
<select onChange={(event) => setShapeType(event.target.value)} value={shapeType}>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import styled from 'styled-components';
2+
3+
const InnerContainer = styled.div`
4+
display: flex;
5+
height: auto;
6+
position: absolute;
7+
width: 100%;
8+
z-index: 1;
9+
`;
10+
11+
export default InnerContainer;

0 commit comments

Comments
 (0)