Skip to content

Commit aa025f9

Browse files
pagetabs: breathing room for anchors (#1513)
1 parent cce8653 commit aa025f9

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add: [Page Tabs](layout/page-tabs) now have a breathing room for headers and footnotes below the tabs row
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
.page-content mark {
22
background-color: var(--znai-search-preview-result-highlight-background-color);
33
color: var(--znai-search-preview-result-highlight-color);
4+
}
5+
6+
.page-content.with-page-tabs [id] {
7+
scroll-margin-top: 32px;
48
}

znai-reactjs/src/doc-elements/page/Page.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,22 @@ class Page extends Component {
3535
const { tocItem } = this.props;
3636

3737
const PageBottomPadding = pageTypesRegistry.pageBottomPaddingComponent(tocItem);
38+
const tabIds = extractTabIds(this.props.content);
39+
const className = "page-content" + (tabIds.length > 0 ? " with-page-tabs" : "");
3840

3941
return (
4042
<React.Fragment>
41-
<div className="page-content" ref={this.contentRootDomRef}>
42-
{this.renderPageContent()}
43+
<div className={className} ref={this.contentRootDomRef}>
44+
{this.renderPageContent(tabIds)}
4345
</div>
4446
<PageBottomPadding />
4547
</React.Fragment>
4648
);
4749
}
4850

49-
renderPageContent() {
51+
renderPageContent(tabIds) {
5052
const { tocItem } = this.props;
5153
const contentRootDom = this.contentRootDomRef.current;
52-
const tabIds = extractTabIds(this.props.content);
5354

5455
if (tabIds.length > 0) {
5556
return <PageTabsPageContent key={tocItem.pageTitle} {...this.props} tabIds={tabIds} contentRootDom={contentRootDom} />;

znai-reactjs/src/layout/DocumentationLayout.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151

5252
overflow-y: scroll;
5353
-webkit-overflow-scrolling: touch;
54+
55+
scroll-padding-top: 24px;
5456
}
5557

5658
.znai-main-panel:focus {

0 commit comments

Comments
 (0)