Skip to content

Commit f29fb08

Browse files
docs: add footer with legal information (#2276)
Co-authored-by: Harbarth, Lukas <lukas.harbarth@sap.com>
1 parent e71b663 commit f29fb08

File tree

110 files changed

+532
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+532
-172
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { Description, DocsContext, Subtitle, Title } from '@storybook/addon-docs';
2+
import React, { useContext } from 'react';
3+
import { version as chartsVersion } from '../../packages/charts/package.json';
4+
import { version } from '../../packages/main/package.json';
5+
import { Import } from '../../.storybook/components/Import';
6+
import { TableOfContent } from '../../.storybook/components/TableOfContent';
7+
import { GitHubLogo } from '../../.storybook/components/GitHub-Mark';
8+
import { FlexBox, FlexBoxAlignItems } from '@ui5/webcomponents-react';
9+
import { Footer } from '../../.storybook/components/Footer';
10+
11+
const Links = () => {
12+
const docsContext = useContext(DocsContext);
13+
const isChart = docsContext.id.startsWith('charts-');
14+
15+
const filePath = docsContext.parameters.fileName.replace(/^\.\//, '');
16+
const folderPath = filePath.substr(0, filePath.lastIndexOf('/'));
17+
18+
const githubUrl = `https://github.com/SAP/ui5-webcomponents-react/tree/main/${folderPath}`;
19+
20+
return (
21+
<>
22+
<br />
23+
<FlexBox alignItems={FlexBoxAlignItems.Center}>
24+
<a title={'View On GitHub'} href={githubUrl}>
25+
<GitHubLogo />
26+
</a>
27+
&nbsp; &nbsp;
28+
<a href={`https://www.npmjs.com/package/@ui5/webcomponents-react${isChart ? '-charts' : ''}`}>
29+
<img
30+
alt="npm badge"
31+
src={`https://badgen.net/badge/@ui5%2Fwebcomponents-react${isChart ? '-charts' : ''}/v${
32+
isChart ? chartsVersion : version
33+
}/blue?icon=npm`}
34+
/>
35+
</a>
36+
</FlexBox>
37+
<br />
38+
</>
39+
);
40+
};
41+
42+
export const DocsHeader = () => {
43+
return (
44+
<>
45+
<Title />
46+
<Subtitle />
47+
<Import />
48+
<Description />
49+
<Links />
50+
<TableOfContent />
51+
</>
52+
);
53+
};

shared/stories/DocsPage.tsx renamed to .storybook/components/DocsPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { DocsHeader } from '@shared/stories/DocsHeader';
1+
import { DocsHeader } from '@docs/DocsHeader';
2+
import { Footer } from '@docs/Footer';
23
import { ArgsTable, Primary, Stories } from '@storybook/addon-docs';
34
import React from 'react';
45

.storybook/components/Footer.tsx

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
import {
2+
FlexBox,
3+
FlexBoxAlignItems,
4+
FlexBoxJustifyContent,
5+
FlexBoxWrap,
6+
Label,
7+
Link,
8+
Popover,
9+
PopoverPlacementType,
10+
WrappingType
11+
} from '@ui5/webcomponents-react';
12+
import { useResponsiveContentPadding } from '@ui5/webcomponents-react-base/dist/hooks';
13+
import { ThemingParameters } from '@ui5/webcomponents-react-base/dist/ThemingParameters';
14+
import React, { useRef } from 'react';
15+
import BestRunLogo from '../../assets/SAP_Best_R_grad_blk_scrn.png';
16+
17+
export const Footer = () => {
18+
const popoverRef = useRef(null);
19+
const footerRef = useRef(null);
20+
const responsivePaddingClass = useResponsiveContentPadding(footerRef.current);
21+
22+
const showPrivacyPopover = (e) => {
23+
popoverRef.current.showAt(e.target);
24+
};
25+
26+
return (
27+
<footer>
28+
<div
29+
ref={footerRef}
30+
className={responsivePaddingClass}
31+
style={{
32+
minHeight: 'var(--_ui5_bar_base_height)',
33+
display: 'flex',
34+
alignItems: 'center',
35+
backgroundColor: ThemingParameters.sapPageFooter_Background,
36+
borderTop: `0.0625rem solid ${ThemingParameters.sapPageFooter_BorderColor}`,
37+
position: 'absolute',
38+
left: 0,
39+
right: 0,
40+
height: 'auto',
41+
overflow: 'hidden'
42+
}}
43+
>
44+
<FlexBox
45+
justifyContent={FlexBoxJustifyContent.SpaceBetween}
46+
alignItems={FlexBoxAlignItems.Center}
47+
wrap={FlexBoxWrap.Wrap}
48+
style={{ width: '100%' }}
49+
>
50+
<FlexBox alignItems={FlexBoxAlignItems.Center} wrap={FlexBoxWrap.Wrap}>
51+
<img src={BestRunLogo} alt="SAP Logo with Text 'The Best Run'" style={{ height: '1.5rem' }} />
52+
<Label wrappingType={WrappingType.Normal}>
53+
© Copyright {new Date().getFullYear()}, SAP SE and UI5 Web Components for React Contributors
54+
</Label>
55+
</FlexBox>
56+
<FlexBox alignItems={FlexBoxAlignItems.Center} wrap={FlexBoxWrap.Wrap}>
57+
<Link onClick={showPrivacyPopover}>Privacy</Link>
58+
&nbsp;
59+
<Label>|</Label>
60+
&nbsp;
61+
<Link href="https://www.sap.com/corporate/en/legal/terms-of-use.html">Terms of Use</Link>
62+
&nbsp;
63+
<Label>|</Label>
64+
&nbsp;
65+
<Link href="https://www.sap.com/corporate/en/legal/impressum.html">Legal Disclosure</Link>
66+
&nbsp;
67+
<Label>|</Label>
68+
&nbsp;
69+
<Link href="https://www.sap.com/corporate/en/legal/trademark.html">Trademarks</Link>
70+
</FlexBox>
71+
</FlexBox>
72+
</div>
73+
<Popover
74+
headerText={'Privacy Statement'}
75+
ref={popoverRef}
76+
placementType={PopoverPlacementType.Top}
77+
data-ui5-compact-size
78+
style={{ width: '360px', maxWidth: '100%' }}
79+
>
80+
<Label wrappingType={WrappingType.Normal}>
81+
This site is hosted by <Link>GitHub Pages</Link>. Please see the <Link>GitHub Privacy Statement</Link> for any
82+
information how GitHub processes your personal data.
83+
</Label>
84+
</Popover>
85+
</footer>
86+
);
87+
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.storybook/main.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module.exports = {
1313
webpack: async (config) => {
1414
config.resolve.alias = {
1515
...config.resolve.alias,
16-
'@shared': path.join(root, 'shared'),
16+
'@docs': path.join(root, '.storybook', 'components'),
1717
'@ui5/webcomponents-react/dist/assets/i18n': path.join(root, 'packages', 'main', 'dist', 'assets', 'i18n'),
1818
'@ui5/webcomponents-react/dist/Assets': path.join(root, 'packages', 'main', 'dist', 'Assets'),
1919
'@ui5/webcomponents-react': path.join(root, 'packages', 'main', 'src'),

.storybook/preview-head.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
}
1515
}
1616

17+
.sbdocs-wrapper {
18+
padding-top: 2rem !important;
19+
}
20+
1721
.sbdocs-title {
1822
font-family: var(--sapFontFamily) !important;
1923
}

0 commit comments

Comments
 (0)