Skip to content

Commit d253703

Browse files
committed
docs
1 parent f10baec commit d253703

File tree

12 files changed

+89
-6
lines changed

12 files changed

+89
-6
lines changed

.storybook/preview.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ const preview: Preview = {
144144
'Knowledge Base',
145145
'Testing with Cypress',
146146
['Setup', 'Commands', 'Queries'],
147+
'Patterns',
147148
'Charts',
148149
['Docs'],
149150
'Data Display',

docs/EmbeddedStackBlitz.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import sdk from '@stackblitz/sdk';
2+
import type { CSSProperties } from 'react';
3+
import { useEffect, useRef } from 'react';
4+
5+
interface EmbeddedStackBlitzProps {
6+
style?: CSSProperties;
7+
projectId: string;
8+
}
9+
10+
export function EmbeddedStackBlitz({ style, projectId }: EmbeddedStackBlitzProps) {
11+
const containerRef = useRef<HTMLDivElement | null>(null);
12+
13+
useEffect(() => {
14+
const container = containerRef.current;
15+
if (!container) {
16+
return;
17+
}
18+
sdk.embedProjectId(container, projectId, {
19+
openFile: 'src/App.tsx',
20+
view: 'editor',
21+
height: '90%',
22+
hideDevTools: true,
23+
terminalHeight: 0,
24+
});
25+
26+
return () => {
27+
if (container) {
28+
container.innerHTML = '';
29+
}
30+
};
31+
}, [projectId]);
32+
33+
return <div ref={containerRef} data-where style={{ height: '80vh', ...style }} />;
34+
}
35+
36+
EmbeddedStackBlitz.displayName = 'EmbeddedStackBlitz';

docs/Patterns.mdx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {Footer} from '@sb/components';
2+
import {Meta} from '@storybook/blocks';
3+
import UXCIntegration from "./UXCIntegration.js"
4+
5+
<Meta title="Patterns / UXC Integration"/>
6+
7+
# UXC Integration
8+
9+
<UXCIntegration/>
10+
11+
<Footer/>

docs/UXCIntegration.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { ThemeProvider } from '@ui5/webcomponents-react';
2+
import UXCIntegrationApp from '../patterns/navigation-layout/src/App.js';
3+
import '../patterns/navigation-layout/src/index.css';
4+
import { EmbeddedStackBlitz } from '@/docs/EmbeddedStackBlitz.js';
5+
6+
function UXCIntegration() {
7+
return (
8+
<div style={{ height: '80vh', position: 'relative' }}>
9+
<ThemeProvider>
10+
<UXCIntegrationApp content={<EmbeddedStackBlitz projectId={'github-k5xmevmm'} />} />
11+
</ThemeProvider>
12+
</div>
13+
);
14+
}
15+
16+
export default UXCIntegration;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"@eslint/compat": "1.2.9",
6565
"@eslint/js": "9.27.0",
6666
"@semantic-release/github": "11.0.3",
67+
"@stackblitz/sdk": "^1.11.0",
6768
"@testing-library/cypress": "10.0.3",
6869
"@types/jscodeshift": "17.3.0",
6970
"@types/node": "22.15.21",

patterns/navigation-layout/src/App.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import NavigationLayoutMode from '@ui5/webcomponents-fiori/dist/types/NavigationLayoutMode.js';
22
import { NavigationLayout, Text, Title } from '@ui5/webcomponents-react';
3+
import type { ReactNode } from 'react';
34
import { useState } from 'react';
45
import { NLShellBar } from './NLShellBar.tsx';
56
import { NLSideNavigation } from './NLSideNavigation.tsx';
67

7-
function App() {
8+
interface AppProps {
9+
content?: ReactNode;
10+
}
11+
12+
function App({ content }: AppProps) {
813
const [mode, setMode] = useState<NavigationLayoutMode>(NavigationLayoutMode.Auto);
914
const [contentTitle, setContentTitle] = useState('Home');
15+
1016
return (
1117
<>
1218
<NavigationLayout
@@ -18,7 +24,7 @@ function App() {
1824
<div className="mainContent">
1925
<Title>{contentTitle}</Title>
2026
<br />
21-
<Text>Content...</Text>
27+
{content ?? <Text>Content...</Text>}
2228
</div>
2329
</NavigationLayout>
2430
</>

patterns/navigation-layout/src/NLShellBar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import {
2525
} from '@ui5/webcomponents-react';
2626
import type { Dispatch, SetStateAction } from 'react';
2727
import { useRef, useState } from 'react';
28+
import avatarPng from './assets/avatar.png';
29+
import SapLogoSvg from './assets/sap-logo.svg';
2830
import { NLUserMenu } from './NLUserMenu.tsx';
2931
import { NotificationsPopover } from './NotificationsPopover.tsx';
3032

@@ -86,7 +88,7 @@ export function NLShellBar(props: NLShellBarProps) {
8688
onClick={handleMenuBtnClick}
8789
/>
8890
}
89-
logo={<img src="sap-logo.svg" alt="SAP Logo" />}
91+
logo={<img src={SapLogoSvg} alt="SAP Logo" />}
9092
content={
9193
<>
9294
<Tag design="Set2" colorScheme="7" data-hide-order="2">
@@ -125,7 +127,7 @@ export function NLShellBar(props: NLShellBarProps) {
125127
}
126128
profile={
127129
<Avatar>
128-
<img src="avatar.png" alt="User Avatar" />
130+
<img src={avatarPng} alt="User Avatar" />
129131
</Avatar>
130132
}
131133
>

patterns/navigation-layout/src/NLUserMenu.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { MessageBoxPropTypes, UserMenuDomRef, UserMenuPropTypes } from '@ui
55
import { MessageBox, Text, UserMenu, UserMenuAccount, UserMenuItem } from '@ui5/webcomponents-react';
66
import type { Dispatch, SetStateAction } from 'react';
77
import { forwardRef, useState } from 'react';
8+
import avatarPng from './assets/avatar.png';
89
import { NLUserSettingsDialog } from './UserSettingsDialog/NLUserSettingsDialog.tsx';
910

1011
interface NLUserMenuProps extends Pick<UserMenuPropTypes, 'open'> {
@@ -70,7 +71,7 @@ export const NLUserMenu = forwardRef<UserMenuDomRef, NLUserMenuProps>((props, re
7071
<>
7172
<UserMenuAccount
7273
loading={accountsLoading}
73-
avatarSrc="avatar.png"
74+
avatarSrc={avatarPng}
7475
titleText="Alain Chevalier 1"
7576
subtitleText="[email protected]"
7677
description="Delivery Manager, SAP SE"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)