Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ObjectPage): Highlight selected section #56

Merged
merged 7 commits into from
Jul 12, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,358 changes: 686 additions & 672 deletions packages/main/__karma_snapshots__/ObjectPage.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/main/__karma_snapshots__/ObjectPageSection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
#### `Renders with children`

```
<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>
<div role="heading" class="-header---"><div class="-title--- -uppercase---">Test</div></div><div class="-sectionContent---"><div class="-sectionContentInner---">This is my Text</div></div>
```

#### `ObjectPage w/ lowercase title`

```
<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>
<div role="heading" class="-header---"><div class="-title---">Test</div></div><div class="-sectionContent---"><div class="-sectionContentInner---">This is my Text</div></div>
```

2 changes: 1 addition & 1 deletion packages/main/__karma_snapshots__/ObjectPageSubSection.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
#### `Render without Crashing`

```
<div class="ObjectPageSubSection-objectPageSubSectionHeaderTitle---"></div><div class="ObjectPageSubSection-subSectionContent---"></div>
<div class="-objectPageSubSectionHeaderTitle---"></div><div class="-subSectionContent---"></div>
```

2 changes: 2 additions & 0 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"dependencies": {
"@ui5/webcomponents": "1.0.0-rc.2",
"@ui5/webcomponents-react-base": "0.3.2-rc.14",
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1",
MarcusNotheis marked this conversation as resolved.
Show resolved Hide resolved
"react-scroll": "^1.7.11",
"react-table": "6.8.6",
"react-toastify": "^5.0.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { mountThemedComponent } from '@shared/tests/utils';
import { expect, use } from 'chai';
import { matchSnapshot } from 'chai-karma-snapshot';
import React, { createRef } from 'react';
import React, { createRef, RefObject } from 'react';
import { Ui5PopoverDomRef } from '../../interfaces/Ui5PopoverDomRef';
import { ActionSheet } from '../../lib/ActionSheet';
import { Button } from '../../lib/Button';

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

it('Ref object', () => {
const ref = createRef();
const ref: RefObject<Ui5PopoverDomRef> = createRef();
const button = <Button />;
mountThemedComponent(<ActionSheet ref={ref} openBy={button} />);
expect((ref.current as any).tagName).to.equal('UI5-POPOVER');
Expand Down
41 changes: 0 additions & 41 deletions packages/main/src/components/ObjectPage/AnchorButton.tsx

This file was deleted.

128 changes: 4 additions & 124 deletions packages/main/src/components/ObjectPage/ObjectPage.jss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,141 +5,21 @@ const styles = ({ parameters }: JSSTheme) => ({
objectPage: {
width: '100%',
height: '100%',
position: 'absolute',
position: 'relative',
display: 'flex',
flexDirection: 'column',
isolation: 'isolate',
whiteSpace: 'normal',
fontFamily: fonts.sapUiFontFamily
},
header: {
flexShrink: 0,
backgroundColor: parameters.sapUiObjectHeaderBackground,
'& $titleBar': {
paddingLeft: '2rem',
display: 'block',
'& $image': {
height: '0',
width: '0',
opacity: '0',
display: 'inline-block',
verticalAlign: 'middle'
},
'& $container': {
display: 'inline-block',
lineHeight: 'normal',
verticalAlign: 'middle',
width: '70%',
boxSizing: 'border-box',
paddingTop: '1.5rem',
'& $title': {
fontSize: '1.375rem',
paddingRight: '1rem',
verticalAlign: 'baseline',
lineHeight: 'normal',
display: 'inline-block',
margin: '0',
fontWeight: 'normal',
color: parameters.sapUiBaseText
},
'& $subTitle': {
display: 'inline-block',
wordBreak: 'break-word',
verticalAlign: 'baseline',
paddingTop: '0.5rem',
fontSize: '0.875rem',
color: parameters.sapUiContentLabelColor
}
},
'& $actions': {
position: 'absolute',
top: '0',
paddingTop: '0.75rem',
right: '1.25rem',
display: 'inline-block',
float: 'right',
verticalAlign: 'top',
'& > *': {
marginLeft: '0.5rem',
padding: 0
}
}
},
'&$stickied': {
'& $image': {
opacity: '1',
height: '3rem',
width: '3rem',
margin: '0.25rem 1rem 0.25rem 0'
}
},
'& $headerContent': {
paddingTop: '1.5rem',
paddingBottom: '0.25rem',
transition: 'max-height 0.5s',
maxHeight: '500px',
overflow: 'hidden',

paddingLeft: '2rem',
position: 'relative',
'& $headerImage': {
maxWidth: '5rem',
maxHeight: '5rem',
display: 'inline-block',
marginRight: '2rem',
marginBottom: '1rem'
},
'& $headerCustomContent': {
display: 'inline-block',
verticalAlign: 'top',
'& > *': {
marginRight: '2rem',
marginBottom: '1rem',
lineHeight: '1.5rem'
}
}
}
},
hideHeaderContent: {
paddingTop: '0.5rem',
marginBottom: '0.5rem',
boxShadow: `inset 0 -1px 0 0 ${parameters.sapUiObjectHeaderBorderColor}`,
display: 'flex',
justifyContent: 'center',
alignItems: 'center'
},
anchorBar: {
paddingLeft: '2rem',
backgroundColor: parameters.sapUiObjectHeaderBackground,
boxShadow: `inset 0 0.125rem ${parameters.sapUiObjectHeaderBackground}`,
boxShadow: `inset 0 -0.0625rem ${parameters.sapUiObjectHeaderBorderColor}, inset 0 0.0625rem ${parameters.sapUiObjectHeaderBorderColor}`,
display: 'flex',
margin: '0px',
height: '2.75rem',
padding: '0px',
listStyle: 'none',
'& $anchorButtonContainer': {
position: 'relative',
display: 'inline-flex',
alignItems: 'center',
cursor: 'pointer',
'&:not(:first-child)': {
marginLeft: '2rem'
}
}
},
titleBar: {},
image: {},
container: {},
title: {},
subTitle: {},
actions: {},
stickied: {},
headerContent: {},
headerImage: {},
headerCustomContent: {},
anchorButtonContainer: {},
active: {},
hiddenHeader: {}
minHeight: '2.75rem'
}
});

export default styles;
10 changes: 10 additions & 0 deletions packages/main/src/components/ObjectPage/ObjectPage.karma.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,14 @@ describe('ObjectPage', () => {
.simulate('click');
expect(getEventFromCallback(callback).getParameter('selectedSectionId')).to.eq('1');
});

it('No Header', () => {
const wrapper = mountThemedComponent(
<ObjectPage selectedSectionId={'2'} noHeader>
<ObjectPageSection id={'1'}>Test</ObjectPageSection>
<ObjectPageSection id={'2'}>Test 2</ObjectPageSection>
</ObjectPage>
);
expect(wrapper.debug()).to.matchSnapshot();
});
});
126 changes: 0 additions & 126 deletions packages/main/src/components/ObjectPage/ObjectPageAnchor.tsx

This file was deleted.

Loading