Skip to content

Commit 42a6a10

Browse files
fix(ObjectPage): Highlight selected section while scrolling (#56)
1 parent 5c408a1 commit 42a6a10

18 files changed

+1954
-1880
lines changed

packages/main/__karma_snapshots__/ObjectPage.md

Lines changed: 686 additions & 672 deletions
Large diffs are not rendered by default.

packages/main/__karma_snapshots__/ObjectPageSection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
#### `Renders with children`
44

55
```
6-
<div role="heading" class="ObjectPageSection-header---"><div class="ObjectPageSection-title--- ObjectPageSection-uppercase---">Test</div></div><div class="ObjectPageSection-sectionContent---"><div class="ObjectPageSection-sectionContentInner---">This is my Text</div></div>
6+
<div role="heading" class="-header---"><div class="-title--- -uppercase---">Test</div></div><div class="-sectionContent---"><div class="-sectionContentInner---">This is my Text</div></div>
77
```
88

99
#### `ObjectPage w/ lowercase title`
1010

1111
```
12-
<div role="heading" class="ObjectPageSection-header---"><div class="ObjectPageSection-title---">Test</div></div><div class="ObjectPageSection-sectionContent---"><div class="ObjectPageSection-sectionContentInner---">This is my Text</div></div>
12+
<div role="heading" class="-header---"><div class="-title---">Test</div></div><div class="-sectionContent---"><div class="-sectionContentInner---">This is my Text</div></div>
1313
```
1414

packages/main/__karma_snapshots__/ObjectPageSubSection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
#### `Render without Crashing`
44

55
```
6-
<div class="ObjectPageSubSection-objectPageSubSectionHeaderTitle---"></div><div class="ObjectPageSubSection-subSectionContent---"></div>
6+
<div class="-objectPageSubSectionHeaderTitle---"></div><div class="-subSectionContent---"></div>
77
```
88

packages/main/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"dependencies": {
2323
"@ui5/webcomponents": "1.0.0-rc.2",
2424
"@ui5/webcomponents-react-base": "0.3.2-rc.15",
25+
"lodash.debounce": "^4.0.8",
2526
"react-scroll": "^1.7.11",
2627
"react-table": "6.8.6",
2728
"react-toastify": "^5.0.1"

packages/main/src/components/ActionSheet/ActionSheet.karma.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { mountThemedComponent } from '@shared/tests/utils';
22
import { expect, use } from 'chai';
33
import { matchSnapshot } from 'chai-karma-snapshot';
4-
import React, { createRef } from 'react';
4+
import React, { createRef, RefObject } from 'react';
5+
import { Ui5PopoverDomRef } from '../../interfaces/Ui5PopoverDomRef';
56
import { ActionSheet } from '../../lib/ActionSheet';
67
import { Button } from '../../lib/Button';
78

@@ -26,7 +27,7 @@ describe('ActionSheet', () => {
2627
});
2728

2829
it('Ref object', () => {
29-
const ref = createRef();
30+
const ref: RefObject<Ui5PopoverDomRef> = createRef();
3031
const button = <Button />;
3132
mountThemedComponent(<ActionSheet ref={ref} openBy={button} />);
3233
expect((ref.current as any).tagName).to.equal('UI5-POPOVER');

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

Lines changed: 0 additions & 41 deletions
This file was deleted.

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

Lines changed: 4 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -5,141 +5,21 @@ const styles = ({ parameters }: JSSTheme) => ({
55
objectPage: {
66
width: '100%',
77
height: '100%',
8-
position: 'absolute',
8+
position: 'relative',
99
display: 'flex',
1010
flexDirection: 'column',
1111
isolation: 'isolate',
1212
whiteSpace: 'normal',
1313
fontFamily: fonts.sapUiFontFamily
1414
},
15-
header: {
16-
flexShrink: 0,
17-
backgroundColor: parameters.sapUiObjectHeaderBackground,
18-
'& $titleBar': {
19-
paddingLeft: '2rem',
20-
display: 'block',
21-
'& $image': {
22-
height: '0',
23-
width: '0',
24-
opacity: '0',
25-
display: 'inline-block',
26-
verticalAlign: 'middle'
27-
},
28-
'& $container': {
29-
display: 'inline-block',
30-
lineHeight: 'normal',
31-
verticalAlign: 'middle',
32-
width: '70%',
33-
boxSizing: 'border-box',
34-
paddingTop: '1.5rem',
35-
'& $title': {
36-
fontSize: '1.375rem',
37-
paddingRight: '1rem',
38-
verticalAlign: 'baseline',
39-
lineHeight: 'normal',
40-
display: 'inline-block',
41-
margin: '0',
42-
fontWeight: 'normal',
43-
color: parameters.sapUiBaseText
44-
},
45-
'& $subTitle': {
46-
display: 'inline-block',
47-
wordBreak: 'break-word',
48-
verticalAlign: 'baseline',
49-
paddingTop: '0.5rem',
50-
fontSize: '0.875rem',
51-
color: parameters.sapUiContentLabelColor
52-
}
53-
},
54-
'& $actions': {
55-
position: 'absolute',
56-
top: '0',
57-
paddingTop: '0.75rem',
58-
right: '1.25rem',
59-
display: 'inline-block',
60-
float: 'right',
61-
verticalAlign: 'top',
62-
'& > *': {
63-
marginLeft: '0.5rem',
64-
padding: 0
65-
}
66-
}
67-
},
68-
'&$stickied': {
69-
'& $image': {
70-
opacity: '1',
71-
height: '3rem',
72-
width: '3rem',
73-
margin: '0.25rem 1rem 0.25rem 0'
74-
}
75-
},
76-
'& $headerContent': {
77-
paddingTop: '1.5rem',
78-
paddingBottom: '0.25rem',
79-
transition: 'max-height 0.5s',
80-
maxHeight: '500px',
81-
overflow: 'hidden',
82-
83-
paddingLeft: '2rem',
84-
position: 'relative',
85-
'& $headerImage': {
86-
maxWidth: '5rem',
87-
maxHeight: '5rem',
88-
display: 'inline-block',
89-
marginRight: '2rem',
90-
marginBottom: '1rem'
91-
},
92-
'& $headerCustomContent': {
93-
display: 'inline-block',
94-
verticalAlign: 'top',
95-
'& > *': {
96-
marginRight: '2rem',
97-
marginBottom: '1rem',
98-
lineHeight: '1.5rem'
99-
}
100-
}
101-
}
102-
},
103-
hideHeaderContent: {
104-
paddingTop: '0.5rem',
105-
marginBottom: '0.5rem',
106-
boxShadow: `inset 0 -1px 0 0 ${parameters.sapUiObjectHeaderBorderColor}`,
107-
display: 'flex',
108-
justifyContent: 'center',
109-
alignItems: 'center'
110-
},
11115
anchorBar: {
11216
paddingLeft: '2rem',
11317
backgroundColor: parameters.sapUiObjectHeaderBackground,
114-
boxShadow: `inset 0 0.125rem ${parameters.sapUiObjectHeaderBackground}`,
18+
boxShadow: `inset 0 -0.0625rem ${parameters.sapUiObjectHeaderBorderColor}, inset 0 0.0625rem ${parameters.sapUiObjectHeaderBorderColor}`,
11519
display: 'flex',
116-
margin: '0px',
11720
height: '2.75rem',
118-
padding: '0px',
119-
listStyle: 'none',
120-
'& $anchorButtonContainer': {
121-
position: 'relative',
122-
display: 'inline-flex',
123-
alignItems: 'center',
124-
cursor: 'pointer',
125-
'&:not(:first-child)': {
126-
marginLeft: '2rem'
127-
}
128-
}
129-
},
130-
titleBar: {},
131-
image: {},
132-
container: {},
133-
title: {},
134-
subTitle: {},
135-
actions: {},
136-
stickied: {},
137-
headerContent: {},
138-
headerImage: {},
139-
headerCustomContent: {},
140-
anchorButtonContainer: {},
141-
active: {},
142-
hiddenHeader: {}
21+
minHeight: '2.75rem'
22+
}
14323
});
14424

14525
export default styles;

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,14 @@ describe('ObjectPage', () => {
148148
.simulate('click');
149149
expect(getEventFromCallback(callback).getParameter('selectedSectionId')).to.eq('1');
150150
});
151+
152+
it('No Header', () => {
153+
const wrapper = mountThemedComponent(
154+
<ObjectPage selectedSectionId={'2'} noHeader>
155+
<ObjectPageSection id={'1'}>Test</ObjectPageSection>
156+
<ObjectPageSection id={'2'}>Test 2</ObjectPageSection>
157+
</ObjectPage>
158+
);
159+
expect(wrapper.debug()).to.matchSnapshot();
160+
});
151161
});

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

Lines changed: 0 additions & 126 deletions
This file was deleted.

0 commit comments

Comments
 (0)