mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 17:44:35 +08:00
Move maxHeight code into anchor, close #8606
This commit is contained in:
parent
98ec9100c3
commit
8fb285fce9
@ -162,7 +162,6 @@ export default class Affix extends React.Component<AffixProps, AffixState> {
|
||||
position: 'fixed',
|
||||
top,
|
||||
left: targetRect.left + elemOffset.left,
|
||||
maxHeight: `calc(100vh - ${top}px)`,
|
||||
width,
|
||||
});
|
||||
this.setPlaceholderStyle({
|
||||
|
@ -3,5 +3,4 @@
|
||||
.@{ant-prefix}-affix {
|
||||
position: fixed;
|
||||
z-index: @zindex-affix;
|
||||
overflow: auto;
|
||||
}
|
||||
|
@ -226,8 +226,16 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
'fixed': !affix && !showInkInFixed,
|
||||
});
|
||||
|
||||
const wrapperStyle = {
|
||||
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh',
|
||||
...style,
|
||||
};
|
||||
|
||||
const anchorContent = (
|
||||
<div className={wrapperClass} style={style}>
|
||||
<div
|
||||
className={wrapperClass}
|
||||
style={wrapperStyle}
|
||||
>
|
||||
<div className={anchorClass}>
|
||||
<div className={`${prefixCls}-ink`} >
|
||||
<span className={inkClass} ref={this.saveInkNode} />
|
||||
|
@ -7,6 +7,7 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
<div
|
||||
class="ant-anchor-wrapper"
|
||||
style="max-height:100vh"
|
||||
>
|
||||
<div
|
||||
class="ant-anchor"
|
||||
@ -82,6 +83,7 @@ exports[`renders ./components/anchor/demo/basic.md correctly 1`] = `
|
||||
exports[`renders ./components/anchor/demo/static.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-anchor-wrapper"
|
||||
style="max-height:100vh"
|
||||
>
|
||||
<div
|
||||
class="ant-anchor fixed"
|
||||
|
@ -7,8 +7,12 @@
|
||||
.reset-component;
|
||||
position: relative;
|
||||
padding-left: @anchor-border-width;
|
||||
|
||||
&-wrapper {
|
||||
background-color: @component-background;
|
||||
overflow: auto;
|
||||
padding-left: 4px;
|
||||
margin-left: -4px;
|
||||
}
|
||||
|
||||
&-ink {
|
||||
|
@ -50,6 +50,8 @@ ul.toc > li {
|
||||
right: 20px;
|
||||
.ant-affix {
|
||||
background: #fff;
|
||||
overflow: auto;
|
||||
max-height: ~"calc(100vh - 16px)";
|
||||
}
|
||||
}
|
||||
.toc-affix-bottom {
|
||||
|
Loading…
Reference in New Issue
Block a user