Skip to content

Commit

Permalink
bugfix: Set center: false cannot align everything to the left (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSzturc committed Oct 6, 2022
1 parent e8bf6f8 commit 2425fdf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export type Options = {
margin: number;
showGrid: boolean;
bg: string;
center: boolean;
log: boolean;
};
6 changes: 6 additions & 0 deletions src/transformers/gridTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import { AttributeTransformer, Properties } from '.';
export class GridTransformer implements AttributeTransformer {
private maxWidth: number;
private maxHeight: number;
private isCenter: boolean;

constructor() {
this.maxWidth = YamlStore.getInstance().options.width;
this.maxHeight = YamlStore.getInstance().options.height;
this.isCenter = YamlStore.getInstance().options.center;
}

private gridAttributeRegex =
Expand Down Expand Up @@ -83,6 +85,10 @@ export class GridTransformer implements AttributeTransformer {
element.addStyle('justify-content', justifyCtx);
break;
}

if (this.isCenter != undefined && !this.isCenter) {
element.addStyle('align-items', 'start');
}
element.deleteAttribute('flow');
element.deleteAttribute('justify-content');
}
Expand Down

0 comments on commit 2425fdf

Please sign in to comment.