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

Do you have any plan to upgrade antd version up to 5.20.0? #10

Open
Jeje01 opened this issue Aug 27, 2024 · 1 comment
Open

Do you have any plan to upgrade antd version up to 5.20.0? #10

Jeje01 opened this issue Aug 27, 2024 · 1 comment

Comments

@Jeje01
Copy link

Jeje01 commented Aug 27, 2024

I want to use gradient mode in ColorPicker, but it supports version over 5.20.0, and nextjs-registry is using antd version of ^5.12.5.
Can I use gradient mode if antd version of nextjs-registry is updated?
And do you have any plan to upgrade the version?

@geekskai
Copy link

npm i @ant-design/cssinjs

new RootStyleRegistry.tsx file

'use client'
import { useState, type PropsWithChildren } from 'react'
import { useServerInsertedHTML } from 'next/navigation'
import { createCache, extractStyle, StyleProvider } from '@ant-design/cssinjs'

export const RootStyleRegistry = ({ children }: PropsWithChildren) => {
  const [cache] = useState(() => createCache())

  useServerInsertedHTML(() => {
    return (
      <script
         dangerouslySetInnerHTML={{
          __html: `</script>${extractStyle(cache)}<script>`,
        }}
      />
    )
   })

   return <StyleProvider cache={cache}>{children}</StyleProvider>
}

in the root layout file

import "./globals.css";
import { RootStyleRegistry } from './RootStyleRegistry'
export default function RootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) {
  return (
    <html lang="en">
      <body>
        <RootStyleRegistry>
          {children}
        </RootStyleRegistry>
      </body>
    </html>
  );
}

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

No branches or pull requests

3 participants
@Jeje01 @geekskai and others