Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#520166 added bootstrap css and Layout component for SXA side #972

Merged
merged 3 commits into from
Apr 12, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* This Layout needs for SXA example. Task where it needed https://dev.azure.com/Sitecore-PD/Products/_workitems/edit/526100
*/
sc-ruslanmatkovskyi marked this conversation as resolved.
Show resolved Hide resolved
import React from 'react';
import Head from 'next/head';
import {
Placeholder,
VisitorIdentification,
getPublicUrl,
LayoutServiceData,
} from '@sitecore-jss/sitecore-jss-nextjs';
import Navigation from 'src/Navigation';

// Prefix public assets with a public URL to enable compatibility with Sitecore Experience Editor.
// If you're not supporting the Experience Editor, you can remove this.
const publicUrl = getPublicUrl();

interface LayoutProps {
layoutData: LayoutServiceData;
}

const Layout = ({ layoutData }: LayoutProps): JSX.Element => {
const { route } = layoutData.sitecore;

return (
<>
<Head>
<title>{route?.fields?.pageTitle?.value || 'Page'}</title>
<link rel="icon" href={`${publicUrl}/favicon.ico`} />
</Head>

{/*
VisitorIdentification is necessary for Sitecore Analytics to determine if the visitor is a robot.
If Sitecore XP (with xConnect/xDB) is used, this is required or else analytics will not be collected for the JSS app.
For XM (CMS-only) apps, this should be removed.

VI detection only runs once for a given analytics ID, so this is not a recurring operation once cookies are established.
*/}
<VisitorIdentification />

<Navigation />
{/* root placeholder for the app, which we add components to using route data */}
<div className="container">
sc-ruslanmatkovskyi marked this conversation as resolved.
Show resolved Hide resolved
<div className="row">
{route && <Placeholder name="jss-main" rendering={route} />}
sc-ruslanmatkovskyi marked this conversation as resolved.
Show resolved Hide resolved
</div>
</div>
</>
);
};

export default Layout;

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { AppProps } from 'next/app';
import { I18nProvider } from 'next-localization';

import 'assets/bootstrap.min.css';
sc-ruslanmatkovskyi marked this conversation as resolved.
Show resolved Hide resolved
import 'assets/sxa-styles.css';
import 'assets/app.css';

Expand Down