-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update template to server components
- Loading branch information
1 parent
6039e23
commit 8e47da0
Showing
9 changed files
with
37 additions
and
30 deletions.
There are no files selected for viewing
8 changes: 7 additions & 1 deletion
8
browser/create-template/templates/nextjs-site/src/components/Image.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,13 @@ | ||
'use client'; | ||
|
||
import { Image as AtomicImage } from '@tomic/react'; | ||
import NoSSR from './NoSSR'; | ||
import React from 'react'; | ||
|
||
export const Image = ({ subject, alt }: { subject: string; alt: string }) => { | ||
return <AtomicImage subject={subject} alt={alt} />; | ||
return ( | ||
<NoSSR> | ||
<AtomicImage subject={subject} alt={alt} /> | ||
</NoSSR> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
browser/create-template/templates/nextjs-site/src/components/NoSSR.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import dynamic from 'next/dynamic'; | ||
import React from 'react'; | ||
|
||
const NoSsr = (props: { children: React.ReactNode }) => ( | ||
<React.Fragment>{props.children}</React.Fragment> | ||
); | ||
|
||
export default dynamic(() => Promise.resolve(NoSsr), { | ||
ssr: false, | ||
}); |
14 changes: 5 additions & 9 deletions
14
browser/create-template/templates/nextjs-site/src/views/Block/ImageGalleryBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters