-
Notifications
You must be signed in to change notification settings - Fork 408
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
03f7099
commit 1c2006b
Showing
13 changed files
with
207 additions
and
27 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
70 changes: 70 additions & 0 deletions
70
plugins/base/frontend/src/main/components/pageSummary/pageSummary.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
@import "src/main/scss/index.scss"; | ||
|
||
.page-summary { | ||
background: $white; | ||
border: 1px solid $grey-border; | ||
position: fixed; | ||
top: 25%; | ||
max-height: 70vh; | ||
right: -2px; | ||
width: 250px; | ||
z-index: 8; | ||
transition: width .2s; | ||
|
||
&.hidden { | ||
width: 3em; | ||
writing-mode: vertical-rl; | ||
text-orientation: mixed; | ||
|
||
.content-wrapper { | ||
h4 { | ||
margin: 0; | ||
padding: 8px; | ||
} | ||
} | ||
} | ||
|
||
.content-wrapper { | ||
padding: 0.5em 0 1em 0; | ||
letter-spacing: 0.2px; | ||
|
||
h4 { | ||
margin: 0 2em; | ||
font-weight: 600; | ||
} | ||
|
||
ul { | ||
list-style-type: none; | ||
width: 100%; | ||
padding: 0; | ||
margin: 1em 0; | ||
overflow-x: hidden; | ||
overflow-y: auto; | ||
max-height: 60vh; | ||
|
||
li { | ||
width: 100%; | ||
padding: 4px 0; | ||
|
||
&:hover { | ||
background: $list-background-hover; | ||
} | ||
|
||
&>a { | ||
margin: 0 2em; | ||
} | ||
|
||
&.selected { | ||
border-left: 4px solid $hover-link-color; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
@media screen and (max-width: 759px){ | ||
/* hide it on smaller screens since it looks super weird when displayed with hidden menu */ | ||
.page-summary { | ||
display: none; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
plugins/base/frontend/src/main/components/pageSummary/pageSummary.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import './pageSummary.scss' | ||
import _ from "lodash"; | ||
import Scrollspy from 'react-scrollspy' | ||
|
||
type PageSummaryProps = { | ||
entries: PageSummaryEntry[], | ||
} | ||
|
||
type PageSummaryEntry = { | ||
location: string, | ||
label: string, | ||
sourceSets: SourceSetFilterKey[] | ||
} | ||
|
||
type SourceSetFilterKey = string | ||
|
||
export const PageSummary: React.FC<PageSummaryProps> = ({ entries }: PageSummaryProps) => { | ||
const [hidden, setHidden] = useState<Boolean>(true); | ||
const [displayableEntries, setDisplayableEntries] = useState<PageSummaryEntry[]>(entries) | ||
|
||
const handleMouseHover = () => { | ||
setHidden(!hidden) | ||
} | ||
|
||
useEffect(() => { | ||
const handeEvent = (event: CustomEvent<SourceSetFilterKey[]>) => { | ||
const displayable = entries.filter((entry) => entry.sourceSets.some((sourceset) => event.detail.includes(sourceset))) | ||
setDisplayableEntries(displayable) | ||
} | ||
|
||
window.addEventListener('sourceset-filter-change', handeEvent) | ||
return () => window.removeEventListener('sourceset-filter-change', handeEvent) | ||
}, [entries]) | ||
|
||
let classnames = "page-summary" | ||
if (hidden) classnames += " hidden" | ||
|
||
return ( | ||
<div | ||
className={classnames} | ||
onMouseEnter={handleMouseHover} | ||
onMouseLeave={handleMouseHover} | ||
> | ||
<div className={"content-wrapper"}> | ||
<h4>On this page</h4> | ||
{!hidden && <Scrollspy items={displayableEntries.map((e) => e.location)} currentClassName="selected"> | ||
{displayableEntries.map((item) => <li><a href={'#' + item.location}>{item.label}</a></li>)} | ||
</Scrollspy>} | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
plugins/base/frontend/src/main/components/search/dokkaSearchAnchor.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
@import "~@jetbrains/ring-ui/components/global/variables.css"; | ||
|
||
$white: #FFFFFF; | ||
$grey-border: #A6AFBA | ||
$grey-border: #DADFE6; | ||
$list-background-hover: rgba(91, 93, 239, 0.15); | ||
$hover-link-color: #5B5DEF; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters