Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(search-results): Top panel state default options in config #1054

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
*/
@Input() showIcons: boolean = true;

/**
* Determine the top panel default state
*/
@Input() topPanelStateDefault: string = 'expanded';

private hasFeatureEmphasisOnSelection: boolean = false;

private showResultsGeometries$$: Subscription;
Expand Down Expand Up @@ -424,19 +429,20 @@ export class SearchResultsToolComponent implements OnInit, OnDestroy {
this.tryAddFeatureToMap(result);
this.searchState.setSelectedResult(result);

if (this.topPanelState === 'initial') {
if (this.topPanelStateDefault !== 'collapsed') {
this.topPanelState = 'expanded';
} else {
this.topPanelState = 'collapsed';
}
}

if (this.topPanelState === 'expanded') {
const igoList = this.computeElementRef()[0];
const selected = this.computeElementRef()[1];
setTimeout(() => {
// To be sure the flexible component has been displayed yet
if (!this.isScrolledIntoView(igoList, selected)) {
this.adjustTopPanel(igoList, selected);
}
}, FlexibleComponent.transitionTime + 50);
}

if (this.topPanelState === 'initial') {
this.topPanelState = 'expanded';
if (!this.isScrolledIntoView(igoList, selected)) {
this.adjustTopPanel(igoList, selected);
}
}
}

Expand Down