Skip to content

Commit

Permalink
[Nextjs] Use the app name as the prefix value for templates (#800)
Browse files Browse the repository at this point in the history
* Add prefix to component names and templates

* Add replacePrefix function to cli package

* Update CHANGELOG

* Update AppRoute import in ConnectedDemo component

* Update definitions files to use uppercase for templates

* Refactor replacePrefix and tests

* Add prefix as flag to jss create nextjs

* Revert react template

* Apply changes
CobyPear authored Sep 8, 2021
1 parent f67bfa5 commit d70c608
Showing 76 changed files with 2,200 additions and 2,046 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@ This project does NOT adhere to [Semantic Versioning](https://semver.org/spec/v2
### New Features & Improvements

`[samples/angular]` Language is now preserved when navigating to another page ([#793](https://github.com/Sitecore/jss/pull/793))
`[samples/nextjs][sitecore-jss-cli]` Prefix added to templates which is replaced on jss create ([#800](https://github.com/Sitecore/jss/pull/800))

## 19.0.0

15 changes: 15 additions & 0 deletions packages/sitecore-jss-cli/src/create/index.test.ts
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ import {
applyNameToPackageJson,
applyHostNameToSitecoreConfig,
applyNameReplacement,
getPascalCaseName,
} from './index';

describe('applyNameReplacement', () => {
@@ -207,3 +208,17 @@ describe('applyHostNameToSitecoreConfig', () => {
expect(result).to.match(/<site ((.|\n|\r)*?)hostName="bar.localhost"/, 'site host name');
});
});

describe('getPascalCaseName', () => {
it('should reformat kebab-case to PascalCase', () => {
const result = getPascalCaseName('my-next-sitecore-app');

expect(result).to.match(/MyNextSitecoreApp/);
});

it('should reformat one word lowercase app name to be capitalized', () => {
const result = getPascalCaseName('onewordappnamenohyphen');

expect(result).to.match(/Onewordappnamenohyphen/);
});
});
71 changes: 70 additions & 1 deletion packages/sitecore-jss-cli/src/create/index.ts
Original file line number Diff line number Diff line change
@@ -65,12 +65,14 @@ export function applyHostNameToSitecoreConfig(configXml: string, hostName: strin
* @param {string} name App name
* @param {string} hostName App hostname
* @param {string} replaceName Name value to replace
* @param {boolean} withPrefix Option to pass to replacePrefix - defaults to false
*/
export function applyNameToProject(
projectFolder: string,
name: string,
hostName: string,
replaceName: string
replaceName: string,
withPrefix?: boolean
) {
// Apply name to package.json file
console.log(chalk.cyan(`Applying name ${name} to package.json...`));
@@ -105,4 +107,71 @@ export function applyNameToProject(

fs.writeFileSync(finalConfigFileName, configXml);
});

replacePrefix(projectFolder, name, replaceName, withPrefix);
}

/**
* Returns a string formatted to PascalCase
* my-next-sitecore-app becomes MyNextSitecoreApp
* @param {string} name
*/
export function getPascalCaseName(name: string): string {
const temp: string[] = name.split('-');
name = temp.map((item: string) => (item = item.charAt(0).toUpperCase() + item.slice(1))).join('');
return name;
}

/**
* Called during jss create, this function replaces the sample's prefix with the app's name on Sitecore templates
* @param {string} projectFolder Project folder
* @param {string} name Name value to replace
* @param {string} prefix Prefix of the sample app's template - should match Jss[RAV|Next]Web
* @param {boolean} withPrefix if true, replaces prefix with app name in PascalCase,
* otherwise strip the prefix
*/
export function replacePrefix(
projectFolder: string,
name: string,
prefix: string,
withPrefix?: boolean
) {
const value: boolean = withPrefix === true ? true : false;

if (!value) {
console.log(chalk.cyan('Removing template prefix...'));
const prefixWithHyphen = prefix + '-';
glob
.sync(path.join(projectFolder, './{data,sitecore/definitions,src}/**/*.*'))
.forEach((filePath: string) => {
let fileContents: string = fs.readFileSync(filePath, 'utf8');

// remove prefix
fileContents = applyNameReplacement(fileContents, prefixWithHyphen, '');
// need to call applyNameReplacement again with original prefix
// to account for GraphQL queries and associated components
fileContents = applyNameReplacement(fileContents, prefix, '');
fs.writeFileSync(filePath, fileContents);

// remove prefix on the filename
const newPath: string = applyNameReplacement(filePath, prefixWithHyphen, '');
fs.renameSync(filePath, newPath);
});
return;
}

console.log(chalk.cyan(`Replacing template prefix with ${getPascalCaseName(name)}...`));
glob
.sync(path.join(projectFolder, './{data,sitecore/definitions,src}/**/*.*'))
.forEach((filePath: string) => {
let fileContents: string = fs.readFileSync(filePath, 'utf8');

// replace prefix with pascal case app name
fileContents = applyNameReplacement(fileContents, prefix, getPascalCaseName(name));
fs.writeFileSync(filePath, fileContents);

// "" on the filename
const newPath: string = applyNameReplacement(filePath, prefix, getPascalCaseName(name));
fs.renameSync(filePath, newPath);
});
}
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
# - is under component-content (normally) or content
# Reuse is accomplished by referencing the content by ID in a route definition.
id: lorem-ipsum-content-block
componentName: ContentBlock
componentName: JssNextWeb-ContentBlock
displayName: Lorem Ipsum Dolor Sit Amet
fields:
content: <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque felis mauris, pretium id neque vitae, vulputate pellentesque tortor. Mauris hendrerit dolor et ipsum lobortis bibendum non finibus neque. Morbi volutpat aliquam magna id posuere. Duis commodo cursus dui, nec interdum velit congue nec. Aliquam erat volutpat. Aliquam facilisis, sapien quis fringilla tincidunt, magna nulla feugiat neque, a consectetur arcu orci eu augue.</p>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: styleguide-content-list-field-shared-1
displayName: Styleguide Content List Item 1 (Shared)
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.js
template: Styleguide-ContentList-Item-Template
template: JssNextWeb-Styleguide-ContentList-Item-Template
fields:
textField: ContentList Demo (Shared) Item 1 Text Field
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: styleguide-content-list-field-shared-2
displayName: Styleguide Content List Item 2 (Shared)
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ContentList-Template.sitecore.js
template: Styleguide-ContentList-Item-Template
template: JssNextWeb-Styleguide-ContentList-Item-Template
fields:
textField: ContentList Demo (Shared) Item 2 Text Field
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: styleguide-item-link-field-shared-1
displayName: Styleguide Item Link Item 1 (Shared)
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.js
template: Styleguide-ItemLink-Item-Template
template: JssNextWeb-Styleguide-ItemLink-Item-Template
fields:
textField: ItemLink Demo (Shared) Item 1 Text Field
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: styleguide-item-link-field-shared-2
displayName: Styleguide Item Link Item 2 (Shared)
# Template defines the available fields. See /sitecore/definitions/templates/Styleguide-ItemLink-Template.sitecore.js
template: Styleguide-ItemLink-Item-Template
template: JssNextWeb-Styleguide-ItemLink-Item-Template
fields:
textField: ItemLink Demo (Shared) Item 2 Text Field
2 changes: 1 addition & 1 deletion samples/nextjs/data/routes/en.yml
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ fields:
# root placeholder names are defined in the package.json config section (required for Sitecore deployment)
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: Welcome to Sitecore JSS
# to author content in YAML, use _multi-line values_ (prefixed with | + endline)
8 changes: 4 additions & 4 deletions samples/nextjs/data/routes/graphql/en.yml
Original file line number Diff line number Diff line change
@@ -2,23 +2,23 @@ fields:
pageTitle: GraphQL | Sitecore JSS
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: Using GraphQL with JSS
content: |
<p>This is a live example of using Integrated GraphQL and Connected GraphQL with a JSS app.
For more information on GraphQL use in JSS, please see <a href="https://jss.sitecore.com" target="_blank" rel="noopener noreferrer">the documentation</a>.</p>
- componentName: GraphQL-Layout
- componentName: JssNextWeb-GraphQL-Layout
placeholders:
jss-graphql-layout:
- componentName: GraphQL-IntegratedDemo
- componentName: JssNextWeb-GraphQL-IntegratedDemo
fields:
sample1: Hello integrated GraphQL world!
sample2:
href: https://www.sitecore.com
target: _blank
text: GraphQL lets you get structured field data too
- componentName: GraphQL-ConnectedDemo
- componentName: JssNextWeb-GraphQL-ConnectedDemo
fields:
sample1: Hello connected GraphQL world!
sample2:
2 changes: 1 addition & 1 deletion samples/nextjs/data/routes/graphql/sample-1/en.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ fields:
pageTitle: Sample 1 Page Title
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: GraphQL Sample 1
content: |
2 changes: 1 addition & 1 deletion samples/nextjs/data/routes/graphql/sample-2/en.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ fields:
pageTitle: Sample 2 Page Title
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: GraphQL Sample 2
content: |
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Using a Custom Route Type enables adding more field data to the route level.
template: ExampleCustomRouteType
template: JssNextWeb-ExampleCustomRouteType
fields:
# Note that custom route types inherit from the default route type automatically.
# This is what makes the `pageTitle` field available here, when it's not defined on the custom route type.
@@ -9,4 +9,4 @@ fields:
content: <p>Custom route type fields are good for things like articles, where you may wish to have a filter UI on content fields, such as author or category. Route level fields are easy to query against, whereas component-level fields are not because it's possible to remove a component from a route. Note that route level fields <em>cannot be personalized</em> because you cannot conditionally swap out the route item for a different content item.</p>
placeholders:
jss-main:
- componentName: Styleguide-CustomRouteType
- componentName: JssNextWeb-Styleguide-CustomRouteType
8 changes: 4 additions & 4 deletions samples/nextjs/data/routes/styleguide/da-DK.yml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ fields:
pageTitle: Styleguide | Sitecore JSS
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: JSS Styleguide
content: |
@@ -11,15 +11,15 @@ placeholders:
Use the <a href="/en/styleguide">English version</a> for full content.
</div>
<p>Indholdet og layoutet på denne side er defineret i <code>/data/routes/styleguide/da-DK.yml</code></p>
- componentName: Styleguide-Layout
- componentName: JssNextWeb-Styleguide-Layout
placeholders:
jss-styleguide-layout:
- componentName: Styleguide-Section
- componentName: JssNextWeb-Styleguide-Section
fields:
heading: Flersprogede mønstre
placeholders:
jss-styleguide-section:
- componentName: Styleguide-Multilingual
- componentName: JssNextWeb-Styleguide-Multilingual
fields:
heading: Brug af ordbogen
sample: Denne tekst kan oversættes til da-DK.yml
66 changes: 33 additions & 33 deletions samples/nextjs/data/routes/styleguide/en.yml
Original file line number Diff line number Diff line change
@@ -2,32 +2,32 @@ fields:
pageTitle: Styleguide | Sitecore JSS
placeholders:
jss-main:
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
heading: JSS Styleguide
content: |
<p>This is a live set of examples of how to use JSS. For more information on using JSS, please see <a href="https://jss.sitecore.com" target="_blank" rel="noopener noreferrer">the documentation</a>.</p>
<p>The content and layout of this page is defined in <code>/data/routes/styleguide/en.yml</code></p>
- componentName: Styleguide-Layout
- componentName: JssNextWeb-Styleguide-Layout
placeholders:
jss-styleguide-layout:
- componentName: Styleguide-Section
- componentName: JssNextWeb-Styleguide-Section
fields:
heading: Content Data
placeholders:
jss-styleguide-section:
- componentName: Styleguide-FieldUsage-Text
- componentName: JssNextWeb-Styleguide-FieldUsage-Text
fields:
heading: Single-Line Text
sample: This is a sample text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a <input type="text">.
sample2: This is another sample text field using rendering options. <mark>HTML supported with encode=false.</mark> Cannot edit because editable=false.
- componentName: Styleguide-FieldUsage-Text
- componentName: JssNextWeb-Styleguide-FieldUsage-Text
fields:
heading: Multi-Line Text
description: "<small>Multi-line text tells Sitecore to use a <code>textarea</code> for editing; consumption in JSS is the same as single-line text.</small>"
sample: This is a sample multi-line text field. <mark>HTML is encoded.</mark> In Sitecore, editors will see a textarea.
sample2: This is another sample multi-line text field using rendering options. <mark>HTML supported with encode=false.</mark>
- componentName: Styleguide-FieldUsage-RichText
- componentName: JssNextWeb-Styleguide-FieldUsage-RichText
fields:
heading: Rich Text
sample: <p>This is a sample rich text field. <mark>HTML is always supported.</mark> In Sitecore, editors will see a WYSIWYG editor for these fields.</p>
@@ -36,7 +36,7 @@ placeholders:
sample2: |
<p>Another sample rich text field, using options. Keep markup entered in rich text fields as simple as possible - ideally bare tags only (no classes). Adding a wrapping class can help with styling within rich text blocks.</p>
<marquee>But you can use any valid HTML in a rich text field!</marquee>
- componentName: Styleguide-FieldUsage-Image
- componentName: JssNextWeb-Styleguide-FieldUsage-Image
fields:
heading: Image
sample1:
@@ -45,7 +45,7 @@ placeholders:
sample2:
src: /data/media/img/jss_logo.png
alt: Sitecore JSS Logo
- componentName: Styleguide-FieldUsage-File
- componentName: JssNextWeb-Styleguide-FieldUsage-File
fields:
heading: File
description: |
@@ -54,27 +54,27 @@ placeholders:
src: /data/media/files/jss.pdf
title: Example File
description: This data will be added to the Sitecore Media Library on import
- componentName: Styleguide-FieldUsage-Number
- componentName: JssNextWeb-Styleguide-FieldUsage-Number
fields:
heading: Number
description: "<small>Number tells Sitecore to use a number entry for editing.</small>"
sample: 1.21
- componentName: Styleguide-FieldUsage-Checkbox
- componentName: JssNextWeb-Styleguide-FieldUsage-Checkbox
fields:
heading: Checkbox
description: |
<small>Note: Sitecore does not support inline editing of Checkbox fields. The value must be edited in Experience Editor by using the edit rendering fields button (looks like a pencil) with the whole component selected.</small>
checkbox: true
checkbox2: false
- componentName: Styleguide-FieldUsage-Date
- componentName: JssNextWeb-Styleguide-FieldUsage-Date
fields:
heading: Date
description: |
<p><small>Both <code>Date</code> and <code>DateTime</code> field types are available. Choosing <code>DateTime</code> will make Sitecore show editing UI for time; both types store complete date and time values internally. Date values in JSS are formatted using <a href="https://en.wikipedia.org/wiki/ISO_8601#Combined_date_and_time_representations" target="_blank">ISO 8601 formatted strings</a>, for example <code>2012-04-23T18:25:43.511Z</code>.</small></p>
<div class="alert alert-warning"><small>Note: this is a JavaScript date format (e.g. <code>new Date().toISOString()</code>), and is different from how Sitecore stores date field values internally. Sitecore-formatted dates will not work.</small></div>
date: "2012-05-04T00:00:00Z"
dateTime: "2018-03-14T15:00:00Z"
- componentName: Styleguide-FieldUsage-Link
- componentName: JssNextWeb-Styleguide-FieldUsage-Link
fields:
heading: General Link
description: <p>A <em>General Link</em> is a field that represents an <code>&lt;a&gt;</code> tag.</p>
@@ -101,7 +101,7 @@ placeholders:
target: _blank
class: font-weight-bold
title: <a> title attribute
- componentName: Styleguide-FieldUsage-ItemLink
- componentName: JssNextWeb-Styleguide-FieldUsage-ItemLink
fields:
heading: Item Link
description: |
@@ -120,10 +120,10 @@ placeholders:
# see /data/content/Styleguide/ItemLinkField for definition of this IDs
id: styleguide-item-link-field-shared-1
localItemLink:
template: Styleguide-ItemLink-Item-Template
template: JssNextWeb-Styleguide-ItemLink-Item-Template
fields:
textField: Referenced item textField
- componentName: Styleguide-FieldUsage-ContentList
- componentName: JssNextWeb-Styleguide-FieldUsage-ContentList
fields:
heading: Content List
description: |
@@ -148,13 +148,13 @@ placeholders:
# note that names are default auto-generated to be unique. Explicitly specified names must be unique.
# NOTE: local item definitions cannot be shared with other content list fields, and are
# generally not preferable compared to using shared definitions.
- template: Styleguide-ContentList-Item-Template
- template: JssNextWeb-Styleguide-ContentList-Item-Template
fields:
textField: Hello World Item 1
- template: Styleguide-ContentList-Item-Template
- template: JssNextWeb-Styleguide-ContentList-Item-Template
fields:
textField: Hello World Item 2
- componentName: Styleguide-FieldUsage-Custom
- componentName: JssNextWeb-Styleguide-FieldUsage-Custom
fields:
heading: Custom Fields
description: |
@@ -166,14 +166,14 @@ placeholders:
</small>
</p>
customIntField: 31337
- componentName: Styleguide-Section
- componentName: JssNextWeb-Styleguide-Section
fields:
heading: Layout Patterns
placeholders:
jss-header:
- componentName: Styleguide-Layout-Reuse
- componentName: JssNextWeb-Styleguide-Layout-Reuse
jss-styleguide-section:
- componentName: Styleguide-Layout-Reuse
- componentName: JssNextWeb-Styleguide-Layout-Reuse
fields:
heading: Reusing Content
description: <p>JSS provides powerful options to reuse content, whether it's sharing a common piece of text across pages or sketching out a site with repeating <em>lorem ipsum</em> content.</p>
@@ -187,41 +187,41 @@ placeholders:
# Use this for quickly comping layouts with FPO content that will not be shared once actual content is entered.
- id: lorem-ipsum-content-block
copy: true
- componentName: ContentBlock
- componentName: JssNextWeb-ContentBlock
fields:
content: <p>Mix and match reused and local content. Check out <code>/data/routes/styleguide/en.yml</code> to see how.</p>
- componentName: Styleguide-Layout-Tabs
- componentName: JssNextWeb-Styleguide-Layout-Tabs
fields:
heading: Tabs
description: <p>Creating hierarchical components like tabs is made simpler in JSS because it's easy to introspect the layout structure.</p>
placeholders:
jss-tabs:
- componentName: Styleguide-Layout-Tabs-Tab
- componentName: JssNextWeb-Styleguide-Layout-Tabs-Tab
fields:
title: Tab 1
content: <p>Tab 1 contents!</p>
- componentName: Styleguide-Layout-Tabs-Tab
- componentName: JssNextWeb-Styleguide-Layout-Tabs-Tab
fields:
title: Tab 2
content: <p>Tab 2 contents!</p>
- componentName: Styleguide-Layout-Tabs-Tab
- componentName: JssNextWeb-Styleguide-Layout-Tabs-Tab
fields:
title: Tab 3
content: <p>Tab 3 contents!</p>
- componentName: Styleguide-Section
- componentName: JssNextWeb-Styleguide-Section
fields:
heading: Sitecore Patterns
placeholders:
jss-styleguide-section:
- componentName: Styleguide-SitecoreContext
- componentName: JssNextWeb-Styleguide-SitecoreContext
fields:
heading: Sitecore Context
description: <p><small>The Sitecore Context contains route-level data about the current context - for example, <code>pageState</code> enables conditionally executing code based on whether Sitecore is in Experience Editor or not.</small></p>
- componentName: Styleguide-RouteFields
- componentName: JssNextWeb-Styleguide-RouteFields
fields:
heading: Route-level Fields
description: <p><small>Route-level content fields are defined on the <em>route</em> instead of on a <em>component</em>. This allows multiple components to share the field data on the same route - and querying is much easier on route level fields, making <em>custom route types</em> ideal for filterable/queryable data such as articles.</small></p>
- componentName: Styleguide-ComponentParams
- componentName: JssNextWeb-Styleguide-ComponentParams
fields:
heading: Component Params
description: <p><small>Component params (also called Rendering Parameters) allow storing non-content parameters for a component. These params should be used for more technical options such as CSS class names or structural settings.</small></p>
@@ -231,16 +231,16 @@ placeholders:
# they are always sent to the component as strings.
columns: 5
useCallToAction: true
- componentName: Styleguide-Tracking
- componentName: JssNextWeb-Styleguide-Tracking
fields:
heading: Tracking
description: <p><small>JSS supports tracking Sitecore analytics events from within apps. Give it a try with this handy interactive demo.</small></p>
- componentName: Styleguide-Section
- componentName: JssNextWeb-Styleguide-Section
fields:
heading: Multilingual Patterns
placeholders:
jss-styleguide-section:
- componentName: Styleguide-Multilingual
- componentName: JssNextWeb-Styleguide-Multilingual
fields:
heading: Translation Patterns
sample: This text can be translated in en.yml
7 changes: 5 additions & 2 deletions samples/nextjs/jss-create.js
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ const { execSync } = require('child_process');
module.exports = function createJssProject(argv, nextSteps) {
console.log(`Executing create script: ${__filename}...`);

applyNameToProject(__dirname, argv.name, argv.hostName, 'JssNextWeb');
applyNameToProject(__dirname, argv.name, argv.hostName, 'JssNextWeb', argv.prefix);

if (!argv.fetchWith || !argv.prerender) {
nextSteps.push(
@@ -35,7 +35,10 @@ module.exports = function createJssProject(argv, nextSteps) {
)} : Specifies the Next.js pre-rendering form for the optional catch-all route. Default is SSG.`,
`* ${chalk.green(
'--empty {true|false}'
)} : Specifies whether the sample should be empty. Disconnected mode and styleguide components will be removed. Default is false.`
)} : Specifies whether the sample should be empty. Disconnected mode and styleguide components will be removed. Default is false.`,
`* ${chalk.green(
'--prefix {true|false}'
)} : Specifies whether the templates should include a prefix. If true, the app's templates will be prefixed with the app's name in PascalCase. This is helpful if deploying multiple apps to the same Sitecore instance. If false, no prefix will be used. Default is false.`
);
}

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function ContentBlock(manifest: Manifest): void {
manifest.addComponent({
name: 'ContentBlock',
name: 'JssNextWeb-ContentBlock',
displayName: 'Content Block',
// totally optional, but fun
icon: SitecoreIcon.DocumentTag,
Original file line number Diff line number Diff line change
@@ -7,14 +7,15 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageCheckbox(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Checkbox',
name: 'JssNextWeb-Styleguide-FieldUsage-Checkbox',
displayName: 'Styleguide-FieldUsage-Checkbox',
icon: SitecoreIcon.CheckboxSelected,
fields: [
{ name: 'checkbox', type: CommonFieldTypes.Checkbox },
{ name: 'checkbox2', type: CommonFieldTypes.Checkbox },
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ import packageJson from '../../../../package.json';
*/
export default function StyleguideFieldUsageContentList(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-ContentList',
name: 'JssNextWeb-Styleguide-FieldUsage-ContentList',
displayName: 'Styleguide-FieldUsage-ContentList',
icon: SitecoreIcon.ListStyle_numbered,
fields: [
{
@@ -24,6 +25,6 @@ export default function StyleguideFieldUsageContentList(manifest: Manifest): voi
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,14 +7,15 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideFieldUsageCustom(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Custom',
name: 'JssNextWeb-Styleguide-FieldUsage-Custom',
displayName: 'Styleguide-FieldUsage-Custom',
icon: SitecoreIcon.Gearwheel,
// NOTE: not using 'CommonFieldTypes' here, because it's a custom field.
// The 'Integer' field ships with Sitecore; something really custom would need to be
// implemented as a Sitecore field type as well.
fields: [{ name: 'customIntField', type: 'Integer' }],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,14 +7,15 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageDate(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Date',
name: 'JssNextWeb-Styleguide-FieldUsage-Date',
displayName: 'Styleguide-FieldUsage-Date',
icon: SitecoreIcon.Clock,
fields: [
{ name: 'date', type: CommonFieldTypes.Date },
{ name: 'dateTime', type: CommonFieldTypes.DateTime },
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageFile(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-File',
name: 'JssNextWeb-Styleguide-FieldUsage-File',
displayName: 'Styleguide-FieldUsage-File',
icon: SitecoreIcon.FloppyDisk,
fields: [{ name: 'file', type: CommonFieldTypes.File }],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,14 +7,15 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageImage(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Image',
name: 'JssNextWeb-Styleguide-FieldUsage-Image',
displayName: 'Styleguide-FieldUsage-Image',
icon: SitecoreIcon.PhotoPortrait,
fields: [
{ name: 'sample1', type: CommonFieldTypes.Image },
{ name: 'sample2', type: CommonFieldTypes.Image },
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@ import packageJson from '../../../../package.json';
*/
export default function StyleguideFieldUsageItemLink(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-ItemLink',
name: 'JssNextWeb-Styleguide-FieldUsage-ItemLink',
displayName: 'Styleguide-FieldUsage-ItemLink',
icon: SitecoreIcon.Link,
fields: [
{
@@ -24,6 +25,6 @@ export default function StyleguideFieldUsageItemLink(manifest: Manifest): void {
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageLink(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Link',
name: 'JssNextWeb-Styleguide-FieldUsage-Link',
displayName: 'Styleguide-FieldUsage-Link',
icon: SitecoreIcon.Link,
fields: [
{ name: 'externalLink', type: CommonFieldTypes.GeneralLink },
@@ -17,6 +18,6 @@ export default function StyleguideFieldUsageLink(manifest: Manifest): void {
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageNumber(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Number',
name: 'JssNextWeb-Styleguide-FieldUsage-Number',
displayName: 'Styleguide-FieldUsage-Number',
icon: SitecoreIcon.NumbersField,
fields: [{ name: 'sample', type: CommonFieldTypes.Number }],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageRichText(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-RichText',
name: 'JssNextWeb-Styleguide-FieldUsage-RichText',
displayName: 'Styleguide-FieldUsage-RichText',
icon: SitecoreIcon.TextField,
fields: [
{ name: 'sample', type: CommonFieldTypes.RichText },
@@ -20,6 +21,6 @@ export default function StyleguideFieldUsageRichText(manifest: Manifest): void {
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideFieldUsageText(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-FieldUsage-Text',
name: 'JssNextWeb-Styleguide-FieldUsage-Text',
displayName: 'Styleguide-FieldUsage-Text',
icon: SitecoreIcon.Text,
fields: [
{ name: 'sample', type: CommonFieldTypes.SingleLineText },
@@ -20,6 +21,6 @@ export default function StyleguideFieldUsageText(manifest: Manifest): void {
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function GraphQLConnectedDemo(manifest: Manifest): void {
manifest.addComponent({
name: 'GraphQL-ConnectedDemo',
name: 'JssNextWeb-GraphQL-ConnectedDemo',
displayName: 'GraphQL-ConnectedDemo',
icon: SitecoreIcon.GraphConnection_directed,
fields: [
{ name: 'sample1', type: CommonFieldTypes.SingleLineText },
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ query IntegratedDemoQuery($datasource: String!, $contextItem: String!, $language
id
name
# Strongly-typed querying on known templates is possible!
...on GraphQLIntegratedDemo {
...on JssNextWebGraphQLIntegratedDemo {
# Single-line text field
sample1 {
# the 'jsonValue' field is a JSON blob that represents the object that
@@ -43,7 +43,7 @@ query IntegratedDemoQuery($datasource: String!, $contextItem: String!, $language
contextItem: item(path: $contextItem, language: $language) {
id
# Get the page title from the app route template
...on AppRoute {
...on JssNextWebAppRoute {
pageTitle {
value
}
@@ -56,7 +56,7 @@ query IntegratedDemoQuery($datasource: String!, $contextItem: String!, $language
# typing fragments can be used anywhere!
# so in this case, we're grabbing the 'pageTitle'
# field on all child route items.
...on AppRoute {
...on JssNextWebAppRoute {
pageTitle {
jsonValue
value
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ const query = fs.readFileSync(
*/
export default function GraphQLIntegratedDemo(manifest: Manifest): void {
manifest.addComponent({
name: 'GraphQL-IntegratedDemo',
name: 'JssNextWeb-GraphQL-IntegratedDemo',
displayName: 'GraphQL-IntegratedDemo',
icon: SitecoreIcon.GraphConnection_directed,
graphQLQuery: query,
fields: [
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function GraphQLLayout(manifest: Manifest): void {
manifest.addComponent({
name: 'GraphQL-Layout',
name: 'JssNextWeb-GraphQL-Layout',
displayName: 'GraphQL-Layout',
icon: SitecoreIcon.Layout,
placeholders: ['jss-graphql-layout'],
});
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideComponentParams(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-ComponentParams',
name: 'JssNextWeb-Styleguide-ComponentParams',
displayName: 'Styleguide-ComponentParams',
icon: SitecoreIcon.WindowDialog,
params: ['cssClass', 'columns', 'useCallToAction'],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@ export default function StyleguideCustomRouteType(manifest: Manifest): void {
// article sections, where you may wish to use route-level fields for
// _sorting and filtering_ (it's difficult to query on component-level field data).
manifest.addRouteType({
name: 'ExampleCustomRouteType',
name: 'JssNextWeb-ExampleCustomRouteType',
displayName: 'ExampleCustomRouteType',
fields: [
{ name: 'headline', type: CommonFieldTypes.SingleLineText },
{ name: 'author', type: CommonFieldTypes.SingleLineText },
@@ -24,7 +25,8 @@ export default function StyleguideCustomRouteType(manifest: Manifest): void {
// We're also adding a component, that we can put on our sample custom route type route.
// This component will display the route level fields on the custom route type.
manifest.addComponent({
name: 'Styleguide-CustomRouteType',
name: 'JssNextWeb-Styleguide-CustomRouteType',
displayName: 'Styleguide-CustomRouteType',
icon: SitecoreIcon.DocumentTag,
});
}
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideLayoutReuse(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Layout-Reuse',
name: 'JssNextWeb-Styleguide-Layout-Reuse',
displayName: 'Styleguide-Layout-Reuse',
icon: SitecoreIcon.DocumentsExchange,
placeholders: ['jss-reuse-example'],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideLayoutTabsTab(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Layout-Tabs-Tab',
name: 'JssNextWeb-Styleguide-Layout-Tabs-Tab',
displayName: 'Styleguide-Layout-Tabs-Tab',
icon: SitecoreIcon.TabPane,
fields: [
{ name: 'title', type: CommonFieldTypes.SingleLineText },
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideLayoutTabs(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Layout-Tabs',
name: 'JssNextWeb-Styleguide-Layout-Tabs',
displayName: 'Styleguide-Layout-Tabs',
icon: SitecoreIcon.DocumentTag,
placeholders: ['jss-tabs'],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideLayout(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Layout',
name: 'JssNextWeb-Styleguide-Layout',
displayName: 'Styleguide-Layout',
icon: SitecoreIcon.Layout,
placeholders: ['jss-styleguide-layout'],
});
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideMultilingual(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Multilingual',
name: 'JssNextWeb-Styleguide-Multilingual',
displayName: 'Styleguide-Multilingual',
icon: SitecoreIcon.FlagGeneric,
fields: [
{
@@ -18,6 +19,6 @@ export default function StyleguideMultilingual(manifest: Manifest): void {
],
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,13 +7,14 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideRouteFields(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-RouteFields',
name: 'JssNextWeb-Styleguide-RouteFields',
displayName: 'Styleguide-RouteFields',
icon: SitecoreIcon.TextField,
// this component gets all of its fields from the _route_,
// so it does not need any local fields defined.

// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, SitecoreIcon, Manifest } from '@sitecore-jss/sitecore
*/
export default function StyleguideSection(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Section',
name: 'JssNextWeb-Styleguide-Section',
displayName: 'Styleguide-Section',
icon: SitecoreIcon.DocumentTag,
fields: [{ name: 'heading', type: CommonFieldTypes.SingleLineText }],
placeholders: ['jss-styleguide-section'],
Original file line number Diff line number Diff line change
@@ -7,10 +7,11 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideSitecoreContext(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-SitecoreContext',
name: 'JssNextWeb-Styleguide-SitecoreContext',
displayName: 'Styleguide-SitecoreContext',
icon: SitecoreIcon.ControlPanel,
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
Original file line number Diff line number Diff line change
@@ -7,10 +7,11 @@ import { SitecoreIcon, Manifest } from '@sitecore-jss/sitecore-jss-manifest';
*/
export default function StyleguideTracking(manifest: Manifest): void {
manifest.addComponent({
name: 'Styleguide-Tracking',
name: 'JssNextWeb-Styleguide-Tracking',
displayName: 'Styleguide-Tracking',
icon: SitecoreIcon.Compass,
// inherit fields from another template (../templates/Styleguide-Explanatory-Component)
// inheritance adds fields defined on the base template(s) implicitly to this component
inherits: ['styleguide-explanatory-component-template'],
inherits: ['JssNextWeb-styleguide-explanatory-component-template'],
});
}
5 changes: 3 additions & 2 deletions samples/nextjs/sitecore/definitions/routes.sitecore.ts
Original file line number Diff line number Diff line change
@@ -19,7 +19,8 @@ export default function addRoutesToManifest(manifest: Manifest): Promise<void> {
const appTemplateSection = 'Page Metadata';

manifest.setDefaultRouteType({
name: 'App Route',
name: 'JssNextWeb-App Route',
displayName: 'App Route',
fields: [
{
name: 'pageTitle',
@@ -28,7 +29,7 @@ export default function addRoutesToManifest(manifest: Manifest): Promise<void> {
type: CommonFieldTypes.SingleLineText,
},
],
insertOptions: ['App Route'],
insertOptions: ['JssNextWeb-App Route'],
});

return mergeFs('./data/routes') // relative to process invocation (i.e. your package.json)
Original file line number Diff line number Diff line change
@@ -6,7 +6,8 @@ import { CommonFieldTypes, Manifest } from '@sitecore-jss/sitecore-jss-manifest'
*/
export default function StyleguideContentListItemTemplate(manifest: Manifest): void {
manifest.addTemplate({
name: 'Styleguide-ContentList-Item-Template',
name: 'JssNextWeb-Styleguide-ContentList-Item-Template',
displayName: 'Styleguide-ContentList-Item-Template',
fields: [{ name: 'textField', type: CommonFieldTypes.SingleLineText }],
});
}
Original file line number Diff line number Diff line change
@@ -10,8 +10,9 @@ import { CommonFieldTypes, Manifest } from '@sitecore-jss/sitecore-jss-manifest'
*/
export default function StyleguideExplanatoryComponent(manifest: Manifest): void {
manifest.addTemplate({
name: 'Styleguide-Explanatory-Component',
id: 'styleguide-explanatory-component-template',
name: 'JssNextWeb-Styleguide-Explanatory-Component',
displayName: 'Styleguide-Explanatory-Component-Template',
id: 'JssNextWeb-styleguide-explanatory-component-template',
fields: [
{ name: 'heading', type: CommonFieldTypes.SingleLineText },
{ name: 'description', type: CommonFieldTypes.RichText },
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@ import { CommonFieldTypes, Manifest } from '@sitecore-jss/sitecore-jss-manifest'
*/
export default function StyleguideItemLinkItemTemplate(manifest: Manifest): void {
manifest.addTemplate({
name: 'Styleguide-ItemLink-Item-Template',
name: 'JssNextWeb-Styleguide-ItemLink-Item-Template',
displayName: 'Styleguide-ItemLink-Item-Template',
fields: [{ name: 'textField', type: CommonFieldTypes.SingleLineText }],
});
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, getFieldValue } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageCheckboxProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, Text, Item, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageContentListProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, Text, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageCustomProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DateField, Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageDateProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { File, FileField, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageFileProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Image, ImageField, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageImageProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Field, Text, Item, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageItemLinkProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Link, LinkField, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageLinkProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text, Field, getFieldValue, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageTextProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RichText, Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageRichTextProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text, Field, getFieldValue, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from 'components/styleguide/Styleguide-Specimen';
import StyleguideSpecimen from 'components/styleguide/JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideFieldUsageTextProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ query ConnectedDemoQuery($datasource: String!, $contextItem: String!, $language:
id
name
# Strongly-typed querying on known templates is possible!
...on GraphQLConnectedDemo {
...on JssNextWebGraphQLConnectedDemo {
# Single-line text field
sample1 {
# the 'jsonValue' field is a JSON blob that represents the object that
@@ -41,7 +41,7 @@ query ConnectedDemoQuery($datasource: String!, $contextItem: String!, $language:
contextItem: item(path: $contextItem, language: $language) {
id
# Get the page title from the app route template
...on AppRoute {
...on JssNextWebAppRoute {
pageTitle {
value
}
@@ -54,7 +54,7 @@ query ConnectedDemoQuery($datasource: String!, $contextItem: String!, $language:
# typing fragments can be used anywhere!
# so in this case, we're grabbing the 'pageTitle'
# field on all child route items.
...on AppRoute {
...on JssNextWebAppRoute {
pageTitle {
jsonValue
value
Original file line number Diff line number Diff line change
@@ -13,10 +13,10 @@ import {
import NextLink from 'next/link';
import {
ConnectedDemoQueryDocument,
AppRoute,
JssNextWebAppRoute as AppRoute,
Item,
GraphQlConnectedDemo as GrapQLConnectedDemoDatasource,
} from './GraphQL-ConnectedDemo.dynamic.graphql';
JssNextWebGraphQlConnectedDemo as GrapQLConnectedDemoDatasource,
} from './JssNextWeb-GraphQL-ConnectedDemo.dynamic.graphql';
import { StyleguideComponentProps } from 'lib/component-props';
import config from 'temp/config';

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideComponentParamsProps = StyleguideComponentProps &
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Placeholder } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideLayoutReuseProps = StyleguideComponentProps & StyleguideSpecimenFields;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactElement } from 'react';
import { withPlaceholder, withSitecoreContext, Text } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentWithContextProps, StyleguideSpecimenFields } from 'lib/component-props';

interface StyleguideLayoutTabsState {
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Text, Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import Link from 'next/link';
import { useI18n } from 'next-localization';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import { StyleguideComponentWithContextProps, StyleguideSpecimenFields } from 'lib/component-props';

type StyleguideMultilingualProps = StyleguideComponentWithContextProps &
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import { Text, Field, useSitecoreContext } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import {
StyleguideComponentProps,
StyleguideSitecoreContextValue,
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useSitecoreContext } from '@sitecore-jss/sitecore-jss-nextjs';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import {
StyleguideSpecimenFields,
StyleguideSitecoreContextValue,
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import { withSitecoreContext } from '@sitecore-jss/sitecore-jss-nextjs';
import { trackingApi } from '@sitecore-jss/sitecore-jss-tracking';
import { dataFetcher } from 'lib/data-fetcher';
import config from 'temp/config';
import StyleguideSpecimen from './Styleguide-Specimen';
import StyleguideSpecimen from './JssNextWeb-Styleguide-Specimen';
import { TrackingRequestOptions } from '@sitecore-jss/sitecore-jss-tracking/types/trackingRequestOptions';
import { StyleguideComponentWithContextProps, StyleguideSpecimenFields } from 'lib/component-props';

3,864 changes: 1,950 additions & 1,914 deletions samples/nextjs/src/temp/GraphQLIntrospectionResult.json

Large diffs are not rendered by default.

0 comments on commit d70c608

Please sign in to comment.