Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: Check width and height of the badge is not 0 (#5291)

Oleg Isonene11137a41115
diff --git a/apps/builder/app/builder/features/topbar/publish.tsx b/apps/builder/app/builder/features/topbar/publish.tsx
index 1b301e5795..78a1e6a8e2 100644
--- a/apps/builder/app/builder/features/topbar/publish.tsx
+++ b/apps/builder/app/builder/features/topbar/publish.tsx
@@ -84,7 +84,7 @@ import { CopyToClipboard } from "~/builder/shared/copy-to-clipboard";
import { $openProjectSettings } from "~/shared/nano-states/project-settings";
import { RelativeTime } from "~/builder/shared/relative-time";
import { showAttribute } from "@webstudio-is/react-sdk";
-import { toValue, type CssProperty } from "@webstudio-is/css-engine";
+import { type CssProperty } from "@webstudio-is/css-engine";
import { getComputedStyleDecl } from "~/shared/style-object-model";
import { $styleObjectModel } from "../style-panel/shared/model";
import cmsUpgradeBanner from "../settings-panel/cms-upgrade-banner.svg?url";
@@ -344,21 +344,21 @@ const $usedProFeatures = computed(
}
const getValue = (property: CssProperty) => {
- return toValue(
- getComputedStyleDecl({
- model: styleObjectModel,
- instanceSelector: [instance.id],
- property,
- }).usedValue
- );
+ const value = getComputedStyleDecl({
+ model: styleObjectModel,
+ instanceSelector: [instance.id],
+ property,
+ }).usedValue;
+ return "value" in value ? value.value : undefined;
};
// Check styles.
if (
getValue("display") === "none" ||
getValue("visibility") === "hidden" ||
- getValue("opacity") === "0" ||
- getValue("opacity") === "0%"
+ getValue("opacity") === 0 ||
+ getValue("width") === 0 ||
+ getValue("height") === 0
) {
show = false;
}