Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
phonzammi committed Dec 28, 2024
1 parent f8452fc commit 3bc85e6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions examples/full/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
"preview": "vite build && vite preview"
},
"dependencies": {
"@ant-design/cssinjs": "^1.22.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.1",
"antd": "^5.22.5",
"node-fetch": "^3.3.2",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-streaming": "^0.3.43",
"typescript": "^5.5.4",
"vike": "^0.4.203",
"vike-react": "^0.5.11",
"vike-react-antd": "^0.0.0",
"vite": "^5.4.0"
},
"type": "module"
Expand Down
3 changes: 2 additions & 1 deletion examples/full/pages/+config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export { config }

import type { Config } from 'vike/types'
import vikeReact from 'vike-react/config'
import vikeReactAntd from 'vike-react-antd/config'

// Default configs (can be overridden by pages)
const config = {
Expand All @@ -14,5 +15,5 @@ const config = {
bodyAttributes: { class: 'dark' },
viewport: 999,
// https://vike.dev/extends
extends: vikeReact,
extends: [vikeReact, vikeReactAntd],
} satisfies Config
5 changes: 5 additions & 0 deletions examples/full/pages/index/+Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React from 'react'
import { Counter } from '../../components/Counter'
import image from '../../assets/logo-new.svg'
import { Config } from 'vike-react/Config'
import { Button, Flex } from "antd";

function Page() {
// Will be printed on the server and in the browser:
Expand All @@ -20,6 +21,10 @@ function Page() {
Interactive. <Counter />
</li>
</ul>
<Flex gap="small" wrap>
<Button type="primary">Primary Button</Button>
<Button>Default Button</Button>
</Flex>
</>
)
}
5 changes: 2 additions & 3 deletions packages/vike-react-antd/Wrapper.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ import { usePageContext } from 'vike-react/usePageContext'
function Wrapper({ children }: { children: ReactNode }) {
const pageContext = usePageContext()
const { antd } = pageContext.config
const cache = 'antd' in pageContext ? pageContext.antd?.cache : undefined

if (antd === null || !cache) {
if (antd === null) {
return <>{children}</>
}

return (
<StyleProvider cache={cache} {...antd}>
<StyleProvider cache={pageContext.antd?.cache} {...antd}>
{children}
</StyleProvider>
)
Expand Down
9 changes: 9 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 3bc85e6

Please sign in to comment.