Skip to content

Commit

Permalink
fix: min width for dropdown and padding for toc
Browse files Browse the repository at this point in the history
  • Loading branch information
berezinant committed Nov 25, 2024
1 parent 356a4f8 commit 86c9c35
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export function onToggleDropdown(dropdown: Element): void {
const buttons = dropdown.querySelectorAll(DROPDOWN_TOGGLE);
buttons?.forEach(toggleDropdownButton);
const list = dropdown.querySelector(DROPDOWN_LIST);
toggleDropdownList(list);
const buttonWidth = (buttons[0] as HTMLElement).offsetWidth;
toggleDropdownList(list, buttonWidth);
}

function toggleDropdownButton(button: Element): void {
Expand All @@ -33,8 +34,13 @@ function toggleDropdownButton(button: Element): void {
}
}

function toggleDropdownList(list: Element | null): void {
function toggleDropdownList(list: Element | null, minWidth?: number): void {
list?.classList.toggle('dropdown--list_expanded');
if (minWidth) {
(list as HTMLElement).style.minWidth = `${minWidth}px`;
} else {
(list as HTMLElement).style.minWidth = 'auto';
}
}

function handleOutsideClick(event: MouseEvent): void {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,6 @@

.sidebar--inner {
padding-top: 12px;
padding-right: var(--size-s1);
padding-bottom: 12px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -2100,6 +2100,8 @@ button.platform-tag:focus-visible {

.sidebar--inner {
padding-bottom: 12px;
padding-right: 4px;
padding-right: var(--size-s1);
padding-top: 12px;
}
:root {
Expand Down

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 86c9c35

Please sign in to comment.