From 0750cd03f5f4d62833cd8e71269de458af5cc1de Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Wed, 14 Jun 2023 17:32:49 +0300 Subject: [PATCH] Fix body layout (#1784) ## Description closes #1781 Also makes body/html layout more modern fixing additional bugs More details https://twitter.com/ChallengesCss/status/1471128244720181258 ## 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: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --- packages/react-sdk/src/css/global-rules.ts | 3 ++- packages/sdk-components-react/src/body.ws.tsx | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/react-sdk/src/css/global-rules.ts b/packages/react-sdk/src/css/global-rules.ts index 3472cead2d..f5cff31a24 100644 --- a/packages/react-sdk/src/css/global-rules.ts +++ b/packages/react-sdk/src/css/global-rules.ts @@ -9,7 +9,8 @@ export const addGlobalRules = ( // @todo we need to figure out all global resets while keeping // the engine aware of all of them. // Ideally, the user is somehow aware and in control of the reset - engine.addPlaintextRule("html {margin: 0; height: 100%}"); + // Layout source https://twitter.com/ChallengesCss/status/1471128244720181258 + engine.addPlaintextRule("html {margin: 0; display: grid; min-height: 100%}"); const fontAssets: FontAsset[] = []; for (const asset of assets.values()) { diff --git a/packages/sdk-components-react/src/body.ws.tsx b/packages/sdk-components-react/src/body.ws.tsx index 156f3528e6..c27221376b 100644 --- a/packages/sdk-components-react/src/body.ws.tsx +++ b/packages/sdk-components-react/src/body.ws.tsx @@ -12,11 +12,6 @@ import type { defaultTag } from "./body"; const presetStyle = { body: [ ...body, - - { - property: "minHeight", - value: { type: "unit", unit: "%", value: 100 }, - }, { property: "fontFamily", value: { type: "keyword", value: "Arial" },