Skip to content

Commit 6f44a72

Browse files
clemaivbersch
authored andcommitted
feat(ObjectPage): Introduce Breadcrumbs and key infos (#246)
1 parent 5bd56bc commit 6f44a72

File tree

8 files changed

+615
-219
lines changed

8 files changed

+615
-219
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
22
presets: ['babel-preset-react-app'],
3-
plugins: ['@babel/plugin-proposal-nullish-coalescing-operator']
3+
plugins: ['@babel/plugin-proposal-nullish-coalescing-operator', '@babel/plugin-proposal-optional-chaining']
44
};

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"prettier:all": "prettier --write --config ./prettier.config.js \"packages/**/*.{ts,tsx}\""
1616
},
1717
"dependencies": {
18+
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
1819
"@storybook/addon-actions": "5.3.0-beta.31",
1920
"@storybook/addon-docs": "5.3.0-beta.31",
2021
"@storybook/addon-info": "5.3.0-beta.31",

packages/main/src/components/ObjectPage/ObjectPage.jss.ts

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { JSSTheme } from '../../interfaces/JSSTheme';
22
import { ZIndex } from '../../enums/ZIndex';
3+
import { CSSProperties } from 'react';
34

45
const styles = ({ parameters }: JSSTheme) => ({
56
objectPage: {
@@ -129,6 +130,7 @@ const styles = ({ parameters }: JSSTheme) => ({
129130
wordBreak: 'break-word',
130131
verticalAlign: 'baseline',
131132
paddingTop: '0.5rem',
133+
paddingBottom: '0.5rem',
132134
fontSize: '0.875rem',
133135
color: parameters.sapUiContentLabelColor
134136
},
@@ -148,7 +150,7 @@ const styles = ({ parameters }: JSSTheme) => ({
148150
},
149151
stickied: {},
150152
headerContent: {
151-
paddingTop: '1.5rem',
153+
//paddingTop: '1.5rem',
152154
paddingBottom: '0.25rem',
153155
transition: 'max-height 0.5s',
154156
maxHeight: '500px',
@@ -160,7 +162,7 @@ const styles = ({ parameters }: JSSTheme) => ({
160162
'& $headerContent': {
161163
paddingTop: 0,
162164
'& > *': {
163-
display: 'inline-block',
165+
display: 'flex',
164166
verticalAlign: 'top',
165167
'&:not(:first-child)': {
166168
marginRight: '2rem',
@@ -192,6 +194,10 @@ const styles = ({ parameters }: JSSTheme) => ({
192194
lineHeight: '1.5rem'
193195
}
194196
},
197+
headerCustomContentItem: {
198+
marginLeft: '1rem'
199+
},
200+
195201
headerImage: {
196202
maxWidth: '5rem',
197203
maxHeight: '5rem',
@@ -202,6 +208,28 @@ const styles = ({ parameters }: JSSTheme) => ({
202208
image: {
203209
width: '100%',
204210
height: '100%'
211+
},
212+
keyInfos: {
213+
'& > *': {
214+
marginLeft: '1rem'
215+
},
216+
display: 'flex',
217+
flexDirection: 'row'
218+
},
219+
flexBoxRow: {
220+
display: 'flex',
221+
flexDirection: 'row'
222+
},
223+
flexBoxColumn: {
224+
display: 'flex',
225+
flexDirection: 'column'
226+
},
227+
flexBoxCenter: {
228+
display: 'flex',
229+
alignItems: 'center'
230+
},
231+
avatar: {
232+
marginRight: '1rem'
205233
}
206234
});
207235

packages/main/src/components/ObjectPage/ObjectPage.test.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import { ObjectPageMode } from '@ui5/webcomponents-react/lib/ObjectPageMode';
99
import { ObjectPageSection } from '@ui5/webcomponents-react/lib/ObjectPageSection';
1010
import { ObjectPageSubSection } from '@ui5/webcomponents-react/lib/ObjectPageSubSection';
1111
import { Text } from '@ui5/webcomponents-react/lib/Text';
12+
import { Title } from '@ui5/webcomponents-react/lib/Title';
13+
import { Breadcrumbs } from '@ui5/webcomponents-react/lib/Breadcrumbs';
14+
import { TitleLevel } from '@ui5/webcomponents-react/lib/TitleLevel';
1215

1316
const renderHeaderContent = () => (
1417
<div style={{ display: 'flex', flexDirection: 'column' }}>
@@ -164,4 +167,39 @@ describe('ObjectPage', () => {
164167
);
165168
expect(wrapper.render()).toMatchSnapshot();
166169
});
170+
171+
const renderKeyInfos = () => (
172+
<>
173+
<div>
174+
<Title level={TitleLevel.H5}>Key Info 1</Title>
175+
<Text>Value 1</Text>
176+
</div>
177+
<div>
178+
<Title level={TitleLevel.H5}>Key Info 2</Title>
179+
<Text>Value 2</Text>
180+
</div>
181+
<div>
182+
<Title level={TitleLevel.H5}>Key Info 3</Title>
183+
<Text>Value 3</Text>
184+
</div>
185+
</>
186+
);
187+
188+
const renderBreadcrumbs = () => (
189+
<Breadcrumbs>
190+
<Link href="PathSegment1">Path1</Link>
191+
<Link href="PathSegment2">Path2</Link>
192+
<Link href="PathSegment3"></Link>
193+
</Breadcrumbs>
194+
);
195+
196+
test('Key Infos', () => {
197+
const wrapper = mountThemedComponent(
198+
<ObjectPage renderKeyInfos={renderKeyInfos} renderBreadcrumbs={renderBreadcrumbs}>
199+
<ObjectPageSection id={'1'}>Test</ObjectPageSection>
200+
<ObjectPageSection id={'2'}>Test 2</ObjectPageSection>
201+
</ObjectPage>
202+
);
203+
expect(wrapper.render()).toMatchSnapshot();
204+
});
167205
});

0 commit comments

Comments
 (0)