Skip to content

Commit

Permalink
Comments/stylistic tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmilton committed Jul 11, 2021
1 parent bb54fea commit 06f3130
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/components/BookmarkBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export function BookmarkBar(): BookmarkBarComponent {
// Add BookmarkNodes one at a time until they can't fit in the bookmark
// bar and then create a folder with the overflowing items
const resize = () => {
// remove all child nodes
// Remove all child nodes
root.textContent = '';

let otherBookmarksFolder;
// XXX: None of the elements we're measuring have a border or margin so
// NOTE: None of the elements we're measuring have a border or margin so
// we can use clientWidth instead of offsetWidth for better performance
let currentWidth = 0;

Expand Down
13 changes: 7 additions & 6 deletions src/components/BookmarkNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ function FolderPopup(
let left: number;

if (topLevel) {
// show top level folder popup bellow its parent
// Show top level folder popup bellow its parent
top = parentRect.bottom;
left = parentRect.left;
} else {
// show nested folder popup beside its parent
// Show nested folder popup beside its parent
top = parentRect.top;
left = parentRect.right;
}
Expand All @@ -49,14 +49,15 @@ function FolderPopup(
// TODO: Although popup position somewhat works it's still buggy in many
// scenarios especially in folders with scrollbars

// should be called directly after mounting component to the DOM
// Only after the component is mounted in the DOM do we have element size
// information so final position adjustment is split into a separate step
root.adjustPosition = () => {
const viewportWidth = document.documentElement.clientWidth;
const width = root.offsetWidth;

if (left + width > viewportWidth) {
// show top level aligned to the right edge of the viewport
// show nested show to the left of its parent
// Show top level aligned to the right edge of the viewport
// Show nested show to the left of its parent
root.style.left = topLevel
? viewportWidth - width + 'px'
: parentRect.left - width + 'px';
Expand Down Expand Up @@ -106,7 +107,7 @@ export function Folder(item: FolderProps): FolderComponent {
if (!popup) {
const parent = root.parentNode as Element;

// immediately close any folder popups on the parent level
// Immediately close any folder popups on the parent level
parent
.querySelectorAll<FolderComponent>('.f')
.forEach((folder) => folder.closePopup());
Expand Down
2 changes: 1 addition & 1 deletion src/components/SearchResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function SearchResult<T extends LinkProps>(
append((isOpenTabs ? TabLink : Link)(item), frag);
});

// remove all child nodes
// Remove all child nodes
l.textContent = '';

append(frag, l);
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// when updating also update references that get an item by index
// NOTE: When updating also update references that get an item by index
export const SECTION_DEFAULT_ORDER = [
'Open Tabs',
'Bookmarks',
Expand Down

0 comments on commit 06f3130

Please sign in to comment.