aboutsummaryrefslogtreecommitdiff
path: root/plugins/base
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-08-21 14:09:13 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-08-21 15:40:12 +0200
commitfaf621b643ad2b4b7103d921d4a2d9d4838a21d6 (patch)
treec4dd0ebacd7f3ad39648be18eace548d7bae6cd2 /plugins/base
parent1634c8a0184749ae9314adecf409851c35e93775 (diff)
downloaddokka-faf621b643ad2b4b7103d921d4a2d9d4838a21d6.tar.gz
dokka-faf621b643ad2b4b7103d921d4a2d9d4838a21d6.tar.bz2
dokka-faf621b643ad2b4b7103d921d4a2d9d4838a21d6.zip
Improve resizing, remove important from styles
Diffstat (limited to 'plugins/base')
-rw-r--r--plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.scss2
-rw-r--r--plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx14
-rw-r--r--plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx2
-rw-r--r--plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt5
4 files changed, 6 insertions, 17 deletions
diff --git a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.scss b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.scss
index b5714ca4..1a61e90f 100644
--- a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.scss
+++ b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.scss
@@ -17,8 +17,8 @@ div#paneSearch {
}
.navigation-pane-search {
- width: 100% !important;
padding-top: 16px;
+ width: 100%;
}
div.paneSearchInputWrapper {
diff --git a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx
index 3174b023..47323e73 100644
--- a/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx
+++ b/plugins/base/frontend/src/main/components/navigationPaneSearch/navigationPaneSearch.tsx
@@ -6,11 +6,8 @@ import './navigationPaneSearch.scss';
import ClearIcon from 'react-svg-loader!./clear.svg';
export const NavigationPaneSearch = () => {
- const defaultWidth = 300
-
const [navigationList, setNavigationList] = useState<Option[]>([]);
const [selected, onSelected] = useState<Option | null>(null);
- const [minWidth, setMinWidth] = useState<number>(defaultWidth);
const [filterValue, setFilterValue] = useState<string>('')
const onChangeSelected = useCallback(
@@ -21,11 +18,7 @@ export const NavigationPaneSearch = () => {
[selected]
);
- const onFilter = (filterValue: string, filteredRecords?: Option[]) => {
- if(filteredRecords){
- const requiredWidth = Math.max(...filteredRecords.map(e => e.label.length*9), defaultWidth)
- setMinWidth(requiredWidth)
- }
+ const onFilter = (filterValue: string) => {
setFilterValue(filterValue)
}
@@ -39,9 +32,10 @@ export const NavigationPaneSearch = () => {
fetch(url)
.then(response => response.json())
.then((result) => {
- setNavigationList(result.map((record: Option) => {
+ setNavigationList(result.map((record: Option, idx: number) => {
return {
...record,
+ key: idx,
rgItemType: List.ListProps.Type.CUSTOM
}
}))
@@ -66,7 +60,7 @@ export const NavigationPaneSearch = () => {
popupClassName={"navigation-pane-popup"}
onSelect={onChangeSelected}
onFilter={onFilter}
- minWidth={minWidth}
+ renderOptimization={false}
/>
<span className={"paneSearchInputClearIcon"} onClick={onClearClick}><ClearIcon /></span>
</div>
diff --git a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx
index 2d9dcb3d..164a925a 100644
--- a/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx
+++ b/plugins/base/frontend/src/main/components/search/dokkaFuzzyFilter.tsx
@@ -68,7 +68,7 @@ export class DokkaFuzzyFilterComponent extends Select {
})
.filter((record: OptionWithSearchResult) => record.matched)
- this.props.onFilter(filterPhrase, matchedRecords)
+ this.props.onFilter(filterPhrase)
return highlightMatchedPhrases(orderRecords(matchedRecords, filterPhrase))
}
diff --git a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
index f4c9a1f7..1afb5569 100644
--- a/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/htmlPreprocessors.kt
@@ -86,11 +86,6 @@ object NavigationPageInstaller : PageTransformer {
children.filter { it is ContentPage && it.documentable is DEnumEntry }.map { visit(it as ContentPage) }
else -> emptyList()
}.sortedBy { it.name.toLowerCase() }
-
- private tailrec fun flattenNavigationNodes(nodes: List<NavigationNode>, acc: List<NavigationNode> = emptyList()): List<NavigationNode> {
- if(nodes.isEmpty()) return acc
- return flattenNavigationNodes(nodes.flatMap { it.children }, nodes.map { it.copy(children = emptyList()) } + acc)
- }
}
object ResourceInstaller : PageTransformer {