fix: fix right-panel blinking when scrolling + css improvements

This commit is contained in:
Roman Hotsiy 2018-03-07 13:00:03 +02:00
parent 4896346998
commit a78f9ab688
No known key found for this signature in database
GPG Key ID: 5CB7B3ACABA57CB0
8 changed files with 32 additions and 9 deletions

View File

@ -3,7 +3,7 @@ import styled from '../../styled-components';
export const LogoImgEl = styled.img`
max-height: ${props => props.theme.logo.maxHeight};
width: auto;
display: inline-block;
display: block;
max-width: 100%;
`;

View File

@ -19,7 +19,9 @@ import { ResponseSamples } from '../ResponseSamples/ResponseSamples';
import { OperationModel as OperationType } from '../../services/models';
const OperationRow = styled(Row)`
transform: translateZ(0);
backface-visibility: hidden;
contain: content;
overflow: hidden;
position: relative;

View File

@ -10,7 +10,7 @@ import { ContentItems } from '../ContentItems/ContentItems';
import { OptionsProvider } from '../OptionsProvider';
import { SideMenu } from '../SideMenu/SideMenu';
import { StickyResponsiveSidebar } from '../StickySidebar/StickyResponsiveSidebar';
import { ApiContent, RedocWrap } from './elements';
import { ApiContent, RedocWrap, BackgroundStub } from './elements';
import { SearchBox } from '../SearchBox/SearchBox';
@ -52,6 +52,7 @@ export class Redoc extends React.Component<RedocProps> {
<ApiInfo store={store} />
<ContentItems items={menu.items as any} />
</ApiContent>
<BackgroundStub />
</RedocWrap>
</OptionsProvider>
</ThemeProvider>

View File

@ -35,11 +35,24 @@ export const RedocWrap = styled.div`
`;
export const ApiContent = styled.div`
z-index: 10;
z-index: 1;
position: relative;
overflow: hidden;
width: calc(100% - ${props => props.theme.menu.width});
${media.lessThan('small')`
width: 100%;
`};
contain: layout;
`;
export const BackgroundStub = styled.div`
background: ${props => props.theme.rightPanel.backgroundColor};
position: absolute;
top: 0;
bottom: 0;
right: 0;
width: calc((100% - ${props => props.theme.menu.width}) * 0.4);
${media.lessThan('medium')`
display: none;
`};
`;

View File

@ -7,7 +7,7 @@ import { MenuItem } from '../SideMenu/MenuItem';
import { MarkerService } from '../../services/MarkerService';
import { SearchDocument } from '../../services/SearchWorker.worker';
import { ClearIcon, SearchIcon, SearchInput, SearchResultsBox } from './elements';
import { ClearIcon, SearchIcon, SearchInput, SearchResultsBox, SearchWrap } from './elements';
export interface SearchBoxProps {
search: SearchStore;
@ -92,7 +92,7 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
results.sort((a, b) => b.score - a.score);
return (
<div>
<SearchWrap>
{this.state.term && <ClearIcon onClick={this.clear}>×</ClearIcon>}
<SearchIcon />
<SearchInput
@ -114,7 +114,7 @@ export class SearchBox extends React.PureComponent<SearchBoxProps, SearchBoxStat
))}
</SearchResultsBox>
)}
</div>
</SearchWrap>
);
}
}

View File

@ -2,6 +2,10 @@ import * as React from 'react';
import styled from '../../styled-components';
import { MenuItemLabel } from '../SideMenu/styled.elements';
export const SearchWrap = styled.div`
padding: 5px 0;
`;
export const SearchInput = styled.input.attrs({
className: 'search-input',
})`

View File

@ -27,7 +27,8 @@ const StyledStickySidebar = withProps<{ open?: boolean }>(styled.div)`
display: flex;
flex-direction: column;
transform: translateZ(0);
backface-visibility: hidden;
contain: strict;
height: 100vh;
position: sticky;

View File

@ -35,7 +35,9 @@ export class MarkdownRenderer {
constructor() {
this.headingEnhanceRenderer = new marked.Renderer();
this.originalHeadingRule = this.headingEnhanceRenderer.heading;
this.originalHeadingRule = this.headingEnhanceRenderer.heading.bind(
this.headingEnhanceRenderer,
);
this.headingEnhanceRenderer.heading = this.headingRule;
}