Skip to content

Commit

Permalink
fix(docs): changed the condition of showOpenInCodeSandbox in CodeDemo
Browse files Browse the repository at this point in the history
  • Loading branch information
kuri-sun committed Mar 16, 2024
1 parent d347079 commit ffcb957
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions apps/docs/components/docs/components/code-demo/code-demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const CodeDemo: React.FC<CodeDemoProps> = ({
isPreviewCentered = false,
// when false .js files will be used
typescriptStrict = false,
showOpenInCodeSandbox,
showOpenInCodeSandbox = true,
isGradientBox = false,
defaultExpanded = false,
previewHeight = "auto",
Expand Down Expand Up @@ -142,7 +142,7 @@ export const CodeDemo: React.FC<CodeDemoProps> = ({
files={files}
highlightedLines={highlightedLines}
showEditor={showEditor}
showOpenInCodeSandbox={showOpenInCodeSandbox || showPreview}
showOpenInCodeSandbox={showOpenInCodeSandbox}
showPreview={showSandpackPreview}
typescriptStrict={typescriptStrict}
/>
Expand Down
3 changes: 3 additions & 0 deletions apps/docs/content/docs/components/autocomplete.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ import {useFilter} from "@react-aria/i18n";
<CodeDemo
title="Fully Controlled"
showPreview={false}
showOpenInCodeSandbox={false}
highlightedLines="63-64,67,69-71"
files={autocompleteContent.fullyControlled}
/>
Expand Down Expand Up @@ -254,6 +255,7 @@ import {useAsyncList} from "@react-stately/data";
typescriptStrict={true}
title="Asynchronous Filtering"
showPreview={false}
showOpenInCodeSandbox={false}
highlightedLines="27-29,33"
files={autocompleteContent.asyncFiltering}
/>
Expand All @@ -280,6 +282,7 @@ import {useInfiniteScroll} from "@nextui-org/use-infinite-scroll";

<CodeDemo
showPreview={false}
showOpenInCodeSandbox={false}
typescriptStrict={true}
title="Asynchronous Loading"
highlightedLines="21-22,25,27"
Expand Down
5 changes: 3 additions & 2 deletions apps/docs/content/docs/components/avatar.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ You can also provide a custom fallback component to be displayed when the `src`

In case you need to customize the avatar even further, you can use the `useAvatar` hook to create your own implementation.

<CodeDemo showPreview={false} title="Custom implementation" files={avatarContent.customImpl} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="Custom implementation" files={avatarContent.customImpl} />


### Custom initials logic

Expand Down Expand Up @@ -120,7 +121,7 @@ By passing the `isGrid` prop to the `AvatarGroup` component, the avatars will be
In case you need to customize the avatar group even further, you can use the `useAvatarGroup` hook and the
`AvatarGroupProvider` to create your own implementation.

<CodeDemo showPreview={false} title="Custom implementation" files={avatarContent.groupCustomImpl} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="Custom implementation" files={avatarContent.groupCustomImpl} />

## Slots

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/button.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ You can customize the `Button` component by passing custom Tailwind CSS classes

You can also use the `useButton` hook to create your own button component.

<CodeDemo showPreview={false} title="Custom Implementation" files={buttonContent.customImpl} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="Custom Implementation" files={buttonContent.customImpl} />

## Button Group

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/image.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ You can use the `fallbackSrc` prop to display a fallback image when:
Next.js provides an optimized [Image](https://nextjs.org/docs/app/api-reference/components/image) component,
you can use it with NextUI `Image` component as well.

<CodeDemo showPreview={false} title="With Next.js Image" files={imageContent.nextjs} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="With Next.js Image" files={imageContent.nextjs} />

> **Note**: NextUI's `Image` component is `client-side`, using hooks like `useState` for loading states
> and animations. Use Next.js `Image` alone if these features aren't required.
Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/docs/components/link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function App() {

In case you need to customize the link even further, you can use the `useLink` hook to create your own implementation.

<CodeDemo showPreview={false} title="Custom implementation" files={linkContent.customImpl} />
<CodeDemo showPreview={false} showOpenInCodeSandbox={false} title="Custom implementation" files={linkContent.customImpl} />

<Spacer y={4} />{" "}

Expand Down

0 comments on commit ffcb957

Please sign in to comment.