nextjs components
v5.2.0
تحذير
لا يتم الحفاظ على هذا المشروع بنشاط.
مجموعة من مكونات React ، التي يتم نسخها من https://vercel.com/design. 1

منشور المدونة من 01/09/2022
# with npm
npm i nextjs-components # with yarn
yarn add nextjs-components يجب نقل هذا المشروع للعمل مع تطبيق Next.js الخاص بك. يوصى باستخدام TRANPILATION المدمج في وحدة NEXT.JS 13.1.0 . (حتى تصل إلى Next.js 13.1.0 ، تعاملت next-transpile-modules هذه.
// next.config.js
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
reactStrictMode : true ,
pageExtensions : [ "tsx" , "ts" ] ,
swcMinify : true ,
transpilePackages : [ "nextjs-components" ] ,
} ;
module . exports = nextConfig ; باستخدام دليل app 13 التالي
"use client" ;
// ./app/layout.tsx
import { ThemeContextProvider } from "nextjs-components/src/contexts/ThemeContext" ;
import "nextjs-components/src/styles/globals.css" ;
export default function RootLayout ( { children } ) {
return (
< html lang = "en" >
< body >
< ThemeContextProvider > { children } </ ThemeContextProvider >
</ body >
</ html >
) ;
} باستخدام العرف التقليدي _app.tsx
// ./pages/_app.tsx
import {
ThemeContextProvider ,
ToastArea ,
ToastsProvider ,
} from "nextjs-components" ;
import "nextjs-components/src/styles/globals.css" ;
function App ( { Component , pageProps } ) {
return (
< ThemeContextProvider >
< ToastsProvider >
< Component { ... pageProps } />
< ToastArea />
</ ToastsProvider >
</ ThemeContextProvider >
) ;
}
export default App ;تحقق من موقع الوثائق لمزيد من الأمثلة!
تحذير
أسقطت دعم create-react-app .
في الإصدارات الأقدم ، تم دعم الاستخدام مع create-react-app . ومع ذلك ، من >=v1.0.0 ، تم إسقاط مجلد مسبق /dist .
هذا لا ينتمي إلى Vercel ↩