Skip to content

Commit

Permalink
Replace ?? with || in styles.ts because unset proto string fields ret…
Browse files Browse the repository at this point in the history
…urn an empty string
  • Loading branch information
wwwillchen committed Jan 29, 2024
1 parent dfe4adb commit 04baea3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mesop/web/src/utils/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ export function formatStyle(styleObj: Style): string {
}
if (styleObj.getMargin()) {
const margin = styleObj.getMargin()!;
style += `margin: ${margin.getTop() ?? 0} ${margin.getRight() ?? 0} ${
margin.getBottom() ?? 0
} ${margin.getLeft() ?? 0};`;
style += `margin: ${margin.getTop() || 0} ${margin.getRight() || 0} ${
margin.getBottom() || 0
} ${margin.getLeft() || 0};`;
}
if (styleObj.getOverflowX()) {
style += `overflow-x: ${styleObj.getOverflowX()};`;
Expand All @@ -96,9 +96,9 @@ export function formatStyle(styleObj: Style): string {
}
if (styleObj.getPadding()) {
const padding = styleObj.getPadding()!;
style += `padding: ${padding.getTop() ?? 0} ${padding.getRight() ?? 0} ${
padding.getBottom() ?? 0
} ${padding.getLeft() ?? 0};`;
style += `padding: ${padding.getTop() || 0} ${padding.getRight() || 0} ${
padding.getBottom() || 0
} ${padding.getLeft() || 0};`;
}
if (styleObj.getPosition()) {
style += `position: ${styleObj.getPosition()};`;
Expand Down

0 comments on commit 04baea3

Please sign in to comment.