diff --git a/packages/ui5-webcomponents-react-seed/src/App.js b/packages/ui5-webcomponents-react-seed/src/App.js index 4f872e0e846..7bd7f50e6e7 100644 --- a/packages/ui5-webcomponents-react-seed/src/App.js +++ b/packages/ui5-webcomponents-react-seed/src/App.js @@ -11,12 +11,6 @@ import Routes from './routes/Routes'; import './App.css'; import CenteredContent from './components/Layout/CenteredContent'; -const style = { - emptySpace: { - paddingTop: '44px', - }, -}; - function App() { const { t } = useTranslation(); @@ -25,7 +19,6 @@ function App() { -
diff --git a/packages/ui5-webcomponents-react-seed/src/components/Popover/Info/PopoverInfo.js b/packages/ui5-webcomponents-react-seed/src/components/Popover/Info/PopoverInfo.js new file mode 100644 index 00000000000..318e8412ff4 --- /dev/null +++ b/packages/ui5-webcomponents-react-seed/src/components/Popover/Info/PopoverInfo.js @@ -0,0 +1,20 @@ +import React from 'react'; + +import { Popover } from '@ui5/webcomponents-react/lib/Popover'; +import { PlacementType } from '@ui5/webcomponents-react/lib/PlacementType'; +import { FlexBoxDirection, Title } from '@ui5/webcomponents-react'; +import { FlexBox } from '@ui5/webcomponents-react/lib/FlexBox'; +import { spacing } from '@ui5/webcomponents-react-base'; + +export default function PopoverInfo({ popoverRef, placementType, title, children }) { + return ( + + +
+ {title} +
+
{children}
+
+
+ ); +} diff --git a/packages/ui5-webcomponents-react-seed/src/components/Popover/List/PopoverListItems.js b/packages/ui5-webcomponents-react-seed/src/components/Popover/List/PopoverListItems.js new file mode 100644 index 00000000000..623e62e94ec --- /dev/null +++ b/packages/ui5-webcomponents-react-seed/src/components/Popover/List/PopoverListItems.js @@ -0,0 +1,19 @@ +import { List, StandardListItem } from '@ui5/webcomponents-react'; +import React from 'react'; +import PopoverInfo from '../Info/PopoverInfo'; + +export default function PopoverListItems({ popoverRef, title, items }) { + return ( + + + {items.map((item, index) => { + return ( + + {item.children} + + ); + })} + + + ); +} diff --git a/packages/ui5-webcomponents-react-seed/src/components/Shell/Shell.js b/packages/ui5-webcomponents-react-seed/src/components/Shell/Shell.js index 3dfa39c3520..5775821b13f 100644 --- a/packages/ui5-webcomponents-react-seed/src/components/Shell/Shell.js +++ b/packages/ui5-webcomponents-react-seed/src/components/Shell/Shell.js @@ -1,9 +1,13 @@ -import React from 'react'; +import React, { useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { useHistory } from 'react-router-dom'; import { ShellBar } from '@ui5/webcomponents-react/lib/ShellBar'; +import { Avatar } from '@ui5/webcomponents-react/lib/Avatar'; +import { AvatarShape } from '@ui5/webcomponents-react/lib/AvatarShape'; +import { AvatarSize } from '@ui5/webcomponents-react/lib/AvatarSize'; import BrowserProvider from '../../util/URL/BrowserProvider'; +import PopoverListItems from '../Popover/List/PopoverListItems'; const style = { shell: { @@ -11,21 +15,43 @@ const style = { width: '100%', zIndex: 100, }, + emptySpace: { + paddingTop: '44px', + }, }; const Shell = ({ title, ...props }) => { const { t } = useTranslation(); const history = useHistory(); + const popoverConfigItemsRef = useRef(null); + const popoverItemsInterface = [ + { + children: t('shell.button.user.settings.item.languageSwitch'), + icon: 'user-settings', + onClick: () => alert('activate language switch dialog'), + }, + { + children: t('shell.button.user.settings.item.themeSwitch'), + icon: 'customize', + onClick: () => alert('activate theme switch dialog'), + }, + ]; return ( - history.push(BrowserProvider.HOME)} - primaryTitle={title} - logo={{t('shell.logo.alt')}} - {...props} - /> + <> + } + onLogoClick={() => history.push(BrowserProvider.HOME)} + profile={} + onProfileClick={(e) => popoverConfigItemsRef.current.openBy(e.detail.targetRef)} + {...props} + /> +
+ + ); }; diff --git a/packages/ui5-webcomponents-react-seed/src/components/Shell/__snapshots__/Shell.test.js.snap b/packages/ui5-webcomponents-react-seed/src/components/Shell/__snapshots__/Shell.test.js.snap index 24382cf0e1c..165cc492931 100644 --- a/packages/ui5-webcomponents-react-seed/src/components/Shell/__snapshots__/Shell.test.js.snap +++ b/packages/ui5-webcomponents-react-seed/src/components/Shell/__snapshots__/Shell.test.js.snap @@ -10,5 +10,13 @@ exports[`Shell.js Test Suite should match snapshot 1`] = ` slot="logo" src="https://sap.github.io/ui5-webcomponents/assets/images/sap-logo-svg.svg" /> + `; diff --git a/packages/ui5-webcomponents-react-seed/src/locales/en/translation.json b/packages/ui5-webcomponents-react-seed/src/locales/en/translation.json index ed0f7920029..ca6181efd61 100644 --- a/packages/ui5-webcomponents-react-seed/src/locales/en/translation.json +++ b/packages/ui5-webcomponents-react-seed/src/locales/en/translation.json @@ -4,6 +4,9 @@ "helmet.title.notfound": "NotFound - TodoList App", "shell.title": "TodoList Application", "shell.logo.alt": "SAP Logo", + "shell.button.user.settings": "User Settings", + "shell.button.user.settings.item.languageSwitch": "Language Switch", + "shell.button.user.settings.item.themeSwitch": "Theme Switch", "page.error.text": "Ops! There was an error in loading this page", "page.error.alt": "Error", "page.notfound.text": "Hmmm, we could find this URL",