Skip to content

Commit

Permalink
fix(TitleRow): alias rowMarginTop to titleMarginBottom
Browse files Browse the repository at this point in the history
  • Loading branch information
erautenberg committed Nov 9, 2023
1 parent a128329 commit aebeb94
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ type TitleRowStyle = NavigationManagerStyle & {
w: number;
titleMarginLeft: number;
titleTextStyle: TextBoxStyle;
titleMarginBottom: number;
/** @deprecated */
rowMarginTop: number;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export default class TitleRow extends Row {
return [...super.tags, 'Title'];
}

static get aliasStyles() {
return [{ prev: 'rowMarginTop', curr: 'titleMarginBottom' }];
}

_titleLoaded() {
this._updateRow();
}
Expand Down Expand Up @@ -87,7 +91,7 @@ export default class TitleRow extends Row {

_updateRow() {
this.Items.patch({
y: this._Title.finalH + this.style.rowMarginTop
y: this._Title.finalH + this.style.titleMarginBottom
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const base = theme => ({
...theme.typography.headline1,
textColor: theme.color.textNeutral
},
rowMarginTop: theme.spacer.lg
titleMarginBottom: theme.spacer.lg
});

export const tone = theme => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ describe('TitleRow', () => {
spyOnMethods: ['_titleLoaded']
}
);
expect(titleRow._Items.y).toBe(titleRow.style.rowMarginTop);
expect(titleRow._Items.y).toBe(titleRow.style.titleMarginBottom);

await titleRow.__titleLoadedSpyPromise;

expect(titleRow._Items.y).toBe(
titleRow._Title.finalH + titleRow.style.rowMarginTop
titleRow._Title.finalH + titleRow.style.titleMarginBottom
);
});
});
Expand Down

0 comments on commit aebeb94

Please sign in to comment.