Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add helper to render CSS variables on the server #385

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

krzysztofzuraw
Copy link
Member

@krzysztofzuraw krzysztofzuraw commented Apr 20, 2023

This PR adds a helper function that can be used to render CSS variables on the server e.g with Next.js SSR. Usage:

import { getCSSVariables } from "@saleor/macaw-ui/next";
import Document, { Head, Html, Main, NextScript } from "next/document";

const css = getCSSVariables("defaultLight"); // or "defaultDark"

export default class AppDocument extends Document {
  render() {
    return (
      <Html style={css}>
        <Head />
        <body>
          <Main />
          <NextScript />
        </body>
      </Html>
    );
  }
}

This PR fixes #344

@vercel
Copy link

vercel bot commented Apr 20, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
macaw-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 20, 2023 7:03am
macaw-ui-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 20, 2023 7:03am

@vercel vercel bot temporarily deployed to Preview – macaw-ui-next April 20, 2023 07:02 Inactive
@vercel vercel bot temporarily deployed to Preview – macaw-ui April 20, 2023 07:03 Inactive
@krzysztofzuraw krzysztofzuraw changed the title fix(#344): add helper to render CSS variables on the server fix: add helper to render CSS variables on the server Apr 20, 2023
@krzysztofzuraw krzysztofzuraw marked this pull request as ready for review April 20, 2023 07:34
@krzysztofzuraw krzysztofzuraw requested review from a team, andrzejewsky and poulch and removed request for a team April 20, 2023 07:36
@krzysztofzuraw
Copy link
Member Author

cc: @lkostrowski

@krzysztofzuraw krzysztofzuraw merged commit 27bf697 into canary Apr 24, 2023
@krzysztofzuraw krzysztofzuraw deleted the fix/344/ssr branch April 24, 2023 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow SSR with MacawUI
3 participants