forked from sitecorelabs/xmcloud-foundation-head
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #73 from sitecorelabs/main
Update to JSS 22.2.0
- Loading branch information
Showing
13 changed files
with
23,544 additions
and
1,433 deletions.
There are no files selected for viewing
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ | |
font-size: $font-small; | ||
color: $image-caption-color; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -27,4 +27,4 @@ | |
} | ||
|
||
@import '@sass/variants/title'; | ||
} | ||
} |
33 changes: 25 additions & 8 deletions
33
headapps/nextjs-starter/src/byoc/index.ts → headapps/nextjs-starter/src/byoc/index.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,26 +1,43 @@ | ||
import React from 'react'; | ||
import * as FEAAS from '@sitecore-feaas/clientside/react'; | ||
import * as Events from '@sitecore-cloudsdk/events/browser'; | ||
import '@sitecore/components/context'; | ||
import dynamic from 'next/dynamic'; | ||
import { context } from 'lib/context'; | ||
import config from 'temp/config'; | ||
import { | ||
LayoutServicePageState, | ||
SitecoreContextReactContext, | ||
} from '@sitecore-jss/sitecore-jss-nextjs'; | ||
/** | ||
* This is an out-of-box bundler for External components (BYOC) (see Sitecore documentation for more details) | ||
* It enables registering components in client-only or SSR/hybrid contexts | ||
* It's recommended to not modify this file - please add BYOC imports in corresponding index.*.ts files instead | ||
*/ | ||
|
||
// Set context properties to be available within BYOC components | ||
FEAAS.setContextProperties(context); | ||
|
||
// Import your client-only components via client-bundle. Nextjs's dynamic() call will ensure they are only rendered client-side | ||
const ClientBundle = dynamic(() => import('./index.client'), { | ||
ssr: false, | ||
}); | ||
|
||
// Import your hybrid (server rendering with client hydration) components via index.hybrid.ts | ||
import './index.hybrid'; | ||
|
||
// As long as component bundle is exported and rendered on page (as an empty element), client-only BYOC components are registered and become available | ||
// The rest of components will be regsitered in both server and client-side contexts when this module is imported into Layout | ||
FEAAS.enableNextClientsideComponents(dynamic, ClientBundle); | ||
|
||
export default FEAAS.ExternalComponentBundle; | ||
// Import your hybrid (server rendering with client hydration) components via index.hybrid.ts | ||
import './index.hybrid'; | ||
|
||
const BYOCInit = (): JSX.Element | null => { | ||
const sitecoreContext = React.useContext(SitecoreContextReactContext).context; | ||
// Set context properties to be available within BYOC components | ||
FEAAS.setContextProperties({ | ||
sitecoreEdgeUrl: config.sitecoreEdgeUrl, | ||
sitecoreEdgeContextId: config.sitecoreEdgeContextId, | ||
pageState: sitecoreContext?.pageState || LayoutServicePageState.Normal, | ||
siteName: sitecoreContext?.site?.name || config.sitecoreSiteName, | ||
eventsSDK: Events, | ||
}); | ||
|
||
return <FEAAS.ExternalComponentBundle />; | ||
}; | ||
|
||
export default BYOCInit; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.