Commit 3ceab7f7 authored by John Lee's avatar John Lee Committed by Commit Bot

Bookmarks WebUI: Reduce indents on bookmark folder structure

https://i.imgur.com/JebuYQs.png

This CL also refactors a bit of the HTML and CSS of the bookmark folder
nodes to make it a bit easier to resize the indents.

Change-Id: Iab935570bf9f6bc695b59c1b894240f4f1171a13
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1618265
Commit-Queue: John Lee <johntlee@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663879}
parent 0a1eec7a
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
bookmarks-folder-node { bookmarks-folder-node {
flex: 1; flex: 1;
overflow-y: auto; overflow-y: auto;
padding: 8px 3px 0 3px; padding: 8px 3px 0 18px;
user-select: none; user-select: none;
} }
......
...@@ -12,33 +12,44 @@ ...@@ -12,33 +12,44 @@
<template> <template>
<style include="shared-style"> <style include="shared-style">
:host { :host {
--padding-start-per-depth: 36px;
display: block; display: block;
} }
.v-centered { #container {
align-items: center; align-items: center;
display: flex; cursor: pointer;
flex-direction: row; display: grid;
grid-template-areas: 'arrow folder label';
grid-template-columns: 24px 24px auto;
height: 40px;
min-width: fit-content;
overflow: hidden;
padding-inline-start: calc(var(--node-depth, 0) * 10px);
} }
.menu-label { #arrow {
color: var(--folder-inactive-color); grid-area: arrow;
font-weight: 500; justify-self: center;
margin-inline-start: 16px; margin: 0;
--cr-icon-button-size: 40px;
} }
#container { #arrow:not([is-open]) {
cursor: pointer; transform: rotate(-90deg);
height: 40px; transition: transform 150ms;
padding-inline-start:
calc(var(--node-depth, 0) * var(--padding-start-per-depth));
position: relative;
} }
#folder-label { .folder-icon {
flex-grow: 1; grid-area: folder;
padding-inline-end: 8px; justify-self: center;
}
.menu-label {
color: var(--folder-inactive-color);
font-weight: 500;
grid-area: label;
padding: 0 6px;
white-space: nowrap;
} }
:host([is-selected-folder_]) .menu-label, :host([is-selected-folder_]) .menu-label,
...@@ -52,15 +63,6 @@ ...@@ -52,15 +63,6 @@
color: var(--google-grey-refresh-700); color: var(--google-grey-refresh-700);
} }
#arrow {
margin: 0 8px;
}
#arrow:not([is-open]) {
transform: rotate(-90deg);
transition: transform 150ms;
}
:host-context([dir='rtl']) #arrow:not([is-open]) { :host-context([dir='rtl']) #arrow:not([is-open]) {
transform: rotate(90deg); transform: rotate(90deg);
} }
...@@ -68,14 +70,9 @@ ...@@ -68,14 +70,9 @@
#arrow[is-open] { #arrow[is-open] {
transform: initial; transform: initial;
} }
[no-children] {
margin-inline-start: 52px; /* The width of the arrow and its margin */
}
</style> </style>
<div id="container" <div id="container"
class="v-centered"
on-click="selectFolder_" on-click="selectFolder_"
on-dblclick="toggleFolder_" on-dblclick="toggleFolder_"
on-contextmenu="onContextMenu_" on-contextmenu="onContextMenu_"
...@@ -89,14 +86,12 @@ ...@@ -89,14 +86,12 @@
tabindex="-1" is-open$="[[isOpen]]" noink aria-hidden="true"> tabindex="-1" is-open$="[[isOpen]]" noink aria-hidden="true">
</cr-icon-button> </cr-icon-button>
</template> </template>
<div id="folder-label" class="v-centered"> <div class="folder-icon"
<div class="folder-icon" open$="[[isSelectedFolder_]]"
open$="[[isSelectedFolder_]]" no-children$="[[!hasChildFolder_]]">
no-children$="[[!hasChildFolder_]]"> </div>
</div> <div class="menu-label" title="[[item_.title]]">
<div class="menu-label elided-text" title="[[item_.title]]"> [[item_.title]]
[[item_.title]]
</div>
</div> </div>
</div> </div>
<div id="descendants" role="group"> <div id="descendants" role="group">
......
...@@ -80,6 +80,12 @@ ...@@ -80,6 +80,12 @@
:host(:focus) { :host(:focus) {
z-index: 1; z-index: 1;
} }
.elided-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style> </style>
<div id="icon"></div> <div id="icon"></div>
<div id="website-title" class="elided-text" title="[[item_.title]]"> <div id="website-title" class="elided-text" title="[[item_.title]]">
......
...@@ -72,12 +72,6 @@ ...@@ -72,12 +72,6 @@
margin: 2px; margin: 2px;
width: 16px; width: 16px;
} }
.elided-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
</style> </style>
</template> </template>
</dom-module> </dom-module>
...@@ -46,12 +46,12 @@ suite('<bookmarks-folder-node>', function() { ...@@ -46,12 +46,12 @@ suite('<bookmarks-folder-node>', function() {
firstGen[0].$['descendants'].querySelectorAll('bookmarks-folder-node'); firstGen[0].$['descendants'].querySelectorAll('bookmarks-folder-node');
// Select nested folder. // Select nested folder.
MockInteractions.tap(secondGen[0].$['folder-label']); MockInteractions.tap(secondGen[0].$['container']);
assertEquals('select-folder', store.lastAction.name); assertEquals('select-folder', store.lastAction.name);
assertEquals(secondGen[0].itemId, store.lastAction.id); assertEquals(secondGen[0].itemId, store.lastAction.id);
// Select folder in a separate subtree. // Select folder in a separate subtree.
MockInteractions.tap(rootFolders[1].$['folder-label']); MockInteractions.tap(rootFolders[1].$['container']);
assertEquals('select-folder', store.lastAction.name); assertEquals('select-folder', store.lastAction.name);
assertEquals(rootFolders[1].itemId, store.lastAction.id); assertEquals(rootFolders[1].itemId, store.lastAction.id);
...@@ -60,7 +60,7 @@ suite('<bookmarks-folder-node>', function() { ...@@ -60,7 +60,7 @@ suite('<bookmarks-folder-node>', function() {
store.notifyObservers(); store.notifyObservers();
store.resetLastAction(); store.resetLastAction();
MockInteractions.tap(rootFolders[1].$['folder-label']); MockInteractions.tap(rootFolders[1].$['container']);
assertEquals(null, store.lastAction); assertEquals(null, store.lastAction);
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment