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.

Merge branch 'main' into 252-fonts-manager-and-fonts-selector

Oleg Isonen43453e07d6a1
diff --cc packages/css-vars/README.md
index a38dc09433,55ca5f1bfa..b7a6e09ae9
--- a/packages/css-vars/README.md
+++ b/packages/css-vars/README.md
@@@ -11,3 -11,68 +11,68 @@@ const myVariable = cssVars.define("my-v
cssVars.use(myVariable, "fallback"); // var(--my-variable-0, fallback)
```
+
+ ## Example using `style` prop
+
+ ```ts
+ import { cssVars } from "css-vars";
+
+ // icon.ts
+ const showVar = cssVars.define("button-show"); // --button-show-0
+
+ export const buttonCssVars = ({ show }: { show: boolean }) => ({
+ [showVar]: show ? "block" : "none",
+ });
+
+ export const Button = () => {
- return <button style={{display: cssVars.use(showVar, "none")}}></button>
-}
++ return <button style={{ display: cssVars.use(showVar, "none") }}></button>;
++};
+
+ // panel.ts
-import {Button, buttonCssVars} from './button'
++import { Button, buttonCssVars } from "./button";
+
+ const Panel = (props) => {
- const [show, setShow] = useState(false)
++ const [show, setShow] = useState(false);
+
+ return (
- <div {...props} style={buttonCssVars({show})} >
++ <div {...props} style={buttonCssVars({ show })}>
+ <Button />
+ </div>
- )
-}
++ );
++};
+ ```
+
+ ## Example using stitches with `:hover`
+
+ ```ts
+ import { cssVars } from "css-vars";
+ import {styled} from 'stitches'
+
+ // icon.ts
+ const showVar = cssVars.define("button-show"); // --button-show-0
+ const primaryBgVar = cssVars.define("button-primary-bg"); // --button-primary-bg-1
+
+ export const buttonCssVars = ({ show, variant }: { show: boolean, variant: 'primary' | 'secondary' }) => ({
+ [showVar]: show ? "block" : "none",
+ [primaryBgVar]: variant === 'primary' ? "red" : "grey",
+ });
+
+ export const Button = styled('button', {
+ display: cssVars.use(showVar, "none")
+ variants: {
+ variant: {
+ primary: {
+ background: cssVars.use(primaryBgVar, "red")
+ }
+ }
+ }
+ })
+
+ // panel.ts
+ import {Button, buttonCssVars} from './button'
+ import {styled} from 'stitches'
+
+ const Panel = styled('div', {
+ '&:hover': buttonCssVars({show: true})
+ })
+ ```
diff --cc packages/fonts/src/index.server.ts
index 0000000000,88ff2a52e6..348b128747
mode 000000,100644..100644
--- a/packages/fonts/src/index.server.ts
+++ b/packages/fonts/src/index.server.ts
@@@ -1,0 -1,2 +1,2 @@@
-export { getFontData } from "./get-font-data";
++export { getFontData } from "./font-data";
+ export * from "./schema";