Skip to content

Commit e11137a

Browse files
authored
fix: Check width and height of the badge is not 0 (#5291)
## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction 1. click button 2. expect xyz ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 0000) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env` file
1 parent 7981060 commit e11137a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

apps/builder/app/builder/features/topbar/publish.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ import { CopyToClipboard } from "~/builder/shared/copy-to-clipboard";
8484
import { $openProjectSettings } from "~/shared/nano-states/project-settings";
8585
import { RelativeTime } from "~/builder/shared/relative-time";
8686
import { showAttribute } from "@webstudio-is/react-sdk";
87-
import { toValue, type CssProperty } from "@webstudio-is/css-engine";
87+
import { type CssProperty } from "@webstudio-is/css-engine";
8888
import { getComputedStyleDecl } from "~/shared/style-object-model";
8989
import { $styleObjectModel } from "../style-panel/shared/model";
9090
import cmsUpgradeBanner from "../settings-panel/cms-upgrade-banner.svg?url";
@@ -344,21 +344,21 @@ const $usedProFeatures = computed(
344344
}
345345

346346
const getValue = (property: CssProperty) => {
347-
return toValue(
348-
getComputedStyleDecl({
349-
model: styleObjectModel,
350-
instanceSelector: [instance.id],
351-
property,
352-
}).usedValue
353-
);
347+
const value = getComputedStyleDecl({
348+
model: styleObjectModel,
349+
instanceSelector: [instance.id],
350+
property,
351+
}).usedValue;
352+
return "value" in value ? value.value : undefined;
354353
};
355354

356355
// Check styles.
357356
if (
358357
getValue("display") === "none" ||
359358
getValue("visibility") === "hidden" ||
360-
getValue("opacity") === "0" ||
361-
getValue("opacity") === "0%"
359+
getValue("opacity") === 0 ||
360+
getValue("width") === 0 ||
361+
getValue("height") === 0
362362
) {
363363
show = false;
364364
}

0 commit comments

Comments
 (0)