Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sidebar spacing issues #372

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/index.html.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</section>
</aside>
<div class="apollon-container">
<main id="apollon"></main>
<main id="apollon"></main>
</div>
</div>
</body>
Expand Down
6 changes: 5 additions & 1 deletion src/main/components/create-pane/create-pane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class CreatePaneComponent extends Component<Props, State> {
};

const { previews, utils } = this.state;

const elements = [...previews, ...utils].reduce<UMLElementState>(
(state, preview) => ({
...state,
Expand All @@ -155,7 +156,10 @@ class CreatePaneComponent extends Component<Props, State> {

return (
<StoreProvider initialState={{ elements, editor: { features } }}>
{this.getElementArray(previews)}
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 8 }}>
{this.getElementArray(previews)}
</div>

{utils && utils.length > 0 ? (
<>
<Separator />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Preview = styled(hoverable(CanvasElement)).attrs((props: { scale?:
overflow: visible;
fill: white;
scale: ${(props) => props.scale ?? 0.8};
transform-origin: center center;
transform-origin: center;
`;

export class PreviewElementComponent extends Component<Props> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const UMLInterfaceComponent: FunctionComponent<Props> = ({ element, fillC
strokeWidth={2}
fillColor={fillColor || element.fillColor}
/>
<Text noY x={'25px'} dominantBaseline="auto" textAnchor="start" fill={element.textColor}>
<Text x={25} noY dominantBaseline="auto" textAnchor="start" fill={element.textColor}>
{element.name}
</Text>
</g>
Expand Down
9 changes: 5 additions & 4 deletions src/main/packages/uml-component-diagram/component-preview.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { ILayer } from '../../services/layouter/layer';
import { UMLElement } from '../../services/uml-element/uml-element';
import { ComposePreview } from '../compose-preview';
import { ComposePreview, PreviewElement } from '../compose-preview';
import { UMLComponentInterface } from './uml-component-interface/uml-component-interface';
import { UMLComponentComponent } from './uml-component/uml-component-component';
import { UMLSubsystem } from './uml-component-subsystem/uml-component-subsystem';

export const composeComponentPreview: ComposePreview = (
layer: ILayer,
translate: (id: string) => string,
): UMLElement[] => {
const elements: UMLElement[] = [];
): PreviewElement[] => {
const elements: PreviewElement[] = [];

// UML Component
const umlComponent = new UMLComponentComponent({ name: translate('packages.ComponentDiagram.Component') });
Expand Down Expand Up @@ -38,7 +38,8 @@ export const composeComponentPreview: ComposePreview = (
width: umlComponentInterface.bounds.width,
height: umlComponentInterface.bounds.height,
};
const [umlInterface] = umlComponentInterface.render(layer) as [UMLElement];
const [umlInterface] = umlComponentInterface.render(layer) as [PreviewElement];
umlInterface.styles = { paddingTop: 8 };
elements.push(umlInterface);

return elements;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`render the uml-component-component 1`] = `
font-weight="bold"
pointer-events="none"
text-anchor="start"
x="25px"
x="25"
>
TestComponentComponent
</text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`render the uml-deployment-interface-component 1`] = `
font-weight="bold"
pointer-events="none"
text-anchor="start"
x="25px"
x="25"
>
TestDeploymentComponent
</text>
Expand Down
Loading