Compare commits

...

4 commits

Author SHA1 Message Date
42cd768cf4 Change menu buttons
All checks were successful
continuous-integration/drone/push Build is passing
2022-08-03 23:00:03 +02:00
ff059626a3 Change text style 2022-08-03 22:52:39 +02:00
23de954c6f Changed index.css to scss 2022-08-03 22:46:05 +02:00
5f312b9ff7 Add text to container 2022-08-03 22:43:42 +02:00
5 changed files with 29 additions and 3 deletions

View file

@ -4,4 +4,16 @@ body,
svg {
height: 100%;
width: 100%;
}
text {
font-size: 18px;
font-weight: 800;
fill: none;
fill-opacity: 0;
stroke: #000000;
stroke-width: 1px;
stroke-linecap: butt;
stroke-linejoin: miter;
stroke-opacity: 1;
}

View file

@ -218,7 +218,7 @@ class App extends React.Component<IAppProps> {
onClick={() => this.ToggleSidebar()}
buttonOnClick={(type: string) => this.AddContainer(type)}
/>
<button className='fixed z-10 top-4 left-4 text-lg bg-blue-200 hover:bg-blue-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleSidebar()}>&#9776; Menu</button>
<button className='fixed z-10 top-4 left-4 text-lg bg-blue-200 hover:bg-blue-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleSidebar()}>&#9776; Components</button>
<ElementsSidebar
MainContainer={this.state.MainContainer}
SelectedContainer={this.state.SelectedContainer}
@ -227,7 +227,7 @@ class App extends React.Component<IAppProps> {
onPropertyChange={(key: string, value: string) => this.OnPropertyChange(key, value)}
selectContainer={(container: Container) => this.SelectContainer(container)}
/>
<button className='fixed z-10 top-4 right-12 text-lg bg-slate-200 hover:bg-slate-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleElementsSidebar()}>&#9776; Menu</button>
<button className='fixed z-10 top-4 right-12 text-lg bg-slate-200 hover:bg-slate-300 transition-all drop-shadow-md hover:drop-shadow-lg py-2 px-3 rounded-lg' onClick={() => this.ToggleElementsSidebar()}>&#9776; Elements</button>
<SVG>
{ this.state.MainContainer }
</SVG>
@ -243,6 +243,8 @@ class App extends React.Component<IAppProps> {
export async function fetchConfiguration(): Promise<Configuration> {
const url = `${import.meta.env.VITE_API_URL}`;
// The test library cannot use the Fetch API
// @ts-ignore
if (window.fetch) {
return await fetch(url, {
method: 'POST'

View file

@ -57,12 +57,17 @@ export class Container extends React.Component<IContainerProps> {
public render(): React.ReactNode {
const containersElements = this.props.children.map(child => child.render());
const xText = (this.props.properties.x * 2 + Number(this.props.properties.width)) / 2;
const yText = (this.props.properties.y * 2 + Number(this.props.properties.height)) / 2;
// g style
const defaultStyle = {
transitionProperty: 'all',
transitionTimingFunction: 'cubic-bezier(0.4, 0, 0.2, 1)',
transitionDuration: '150ms'
} as React.CSSProperties;
// Rect style
const style = Object.assign(
JSON.parse(JSON.stringify(defaultStyle)),
this.props.properties
@ -72,6 +77,7 @@ export class Container extends React.Component<IContainerProps> {
delete style.height;
delete style.width;
// Dimension props
const id = `dim-${this.props.properties.id}`;
const xStart: number = 0;
const xEnd = Number(this.props.properties.width);
@ -99,6 +105,12 @@ export class Container extends React.Component<IContainerProps> {
style={style}
>
</rect>
<text
x={xText}
y={yText}
>
{this.props.properties.id}
</text>
{ containersElements }
</g>
);

View file

@ -1,7 +1,7 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
import './index.css';
import './index.scss';
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<React.StrictMode>