Closed manudeli closed 1 month ago
@minsoo-web How about making Pull Request for adding codesandbox embed in documentation Let's make our documentation like Panda CSS. Can I assign you with me?
Of course. It is my pleasure. I will do my best 🚀🚀🚀
How about like this case ? https://polaris.shopify.com/components/typography/text
@minsoo-web Could I assign you for v2 docs soon?
@sonsurim We need someone have no experience for this library to see how difficulty to onboard with this. Could you be the one to see it objectively?
@minsoo-web Could I assign you for v2 docs soon?
Of course, I'll work on it
@sonsurim We need someone have no experience for this library to see how difficulty to onboard with this. Could you be the one to see it objectively?
@manudeli Sure, that's great, I'll see it out and leave a comment!
@manudeli I was just wondering, Could I see it when it's done?
@manudeli I was just wondering, Could I see it when it's done?
@sonsurim I guess that v2 will be release until at least in March, After then We need to do this work(codesandbox for interactive examples) in v2. at that time We need your help for new examples or comment or review
https://github.com/TanStack/query/blob/main/.codesandbox/ci.json
We can check examples in Pull Request too.
@manudeli
I'd like to ask for your opinion, the docs of @chara-ui/react, which I'm using as a reference, are provided as a library called react-live. I'm impressed that you can add scope, so that you can modify only the code blocks you need without separate function declarations and import syntax.
However, I think the import syntax is necessary information for the user, and the function declaration and use-case should also show the entire code. I'd love to hear your thoughts on whether using react-live
or sandpack
is the right way to go!
@kangju2000 @minsoo-web Make and share plan to implement this feature on https://suspensive.org/ please
@manudeli @minsoo-web
While searching for references, I came across a plugin called remark-sandpack
On react.dev, they compile MDX directly, but since Suspensive uses Nextra, we can attach the remark plugin.
If you use the plugin, here's how to do it:
next.config.js
// eslint-disable-next-line @typescript-eslint/no-var-requires, import/order
const { remarkSandpack } = require('remark-sandpack')
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment, import/order
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
defaultShowCopyCode: true,
+ mdxOptions: {
+ remarkPlugins: [remarkSandpack],
+ },
})
/** @type {import('next').NextConfig} */
module.exports = withNextra({
i18n: {
locales: ['en', 'ko'],
defaultLocale: 'en',
},
})
import { Sandpack } from '@/components'
<Sandpack
customSetup={{
dependencies: {
'@suspensive/react': 'latest',
'@suspensive/react-query': 'latest',
'@tanstack/react-query': '^4.0.0',
},
}}
>
```js /App.tsx
import Example from './Example'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
const queryClient = new QueryClient()
export default function App() {
return (
<QueryClientProvider client={queryClient}>
<Example />
</QueryClientProvider>
)
}
import { wrap } from '@suspensive/react'
import { useSuspenseQuery } from '@suspensive/react-query'
import { api } from './api'
export default wrap
.ErrorBoundaryGroup({ blockOutside: false })
.ErrorBoundary({ fallback: ({ error }) => <>{error.message}</> })
.Suspense({ fallback: <>loading...</>, clientOnly: true })
.on(() => {
const query = useSuspenseQuery({
queryKey: ['key'],
queryFn: () => api.text(),
})
return <>{query.data.text}</>
})
export const api = {
text: async () => {
await new Promise((resolve) => setTimeout(resolve, 1000))
return { text: 'Hello, Suspensive!' }
},
}
### Result
https://github.com/toss/suspensive/assets/23312485/370b6508-cd9b-494d-8ea6-28273eaabba8
How about using this instead of implementing it ourselves?
The differences in markdown rules on react.dev are as follows:
Wow.........!!!!!!!!! So much cooool! Could you make Pull Request too?
How about using this instead of implementing it ourselves?
Cool! I agree this
@kangju2000 Could you make playgrounds of Suspensive 1 page by 1 page or 1 feature by 1 feaure please?
Migrating to v2
<Suspense />
<ErrorBoundary />
<ErrorBoundaryGroup />
https://github.com/toss/suspensive/pull/1002<Delay />
<SuspensiveProvider />
<DevMode />
wrap
https://github.com/toss/suspensive/pull/1017Migrating to v2
useSuspenseQuery
https://github.com/toss/suspensive/pull/1003useSuspenseQueries
https://github.com/toss/suspensive/pull/1003useSuspenseInfiniteQuery
https://github.com/toss/suspensive/pull/1003queryOptions
<SuspenseQuery />
https://github.com/toss/suspensive/pull/1016<SuspenseQueries />
https://github.com/toss/suspensive/pull/1016<SuspenseInfiniteQuery />
https://github.com/toss/suspensive/pull/1016<QueryErrorBoundary />
<Await />
<Image />
Package Scope
docs
Package name:
Overview
Describe the solution you'd like
Additional context