OLD | NEW |
---|---|
1 <link rel="import" href="chrome://resources/html/polymer.html"> | 1 <link rel="import" href="chrome://resources/html/polymer.html"> |
2 <link rel="import" href="chrome://resources/cr_elements/icons.html"> | 2 <link rel="import" href="chrome://resources/cr_elements/icons.html"> |
3 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> | 3 <link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.htm l"> |
4 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> | 4 <link rel="import" href="chrome://resources/polymer/v1_0/paper-icon-button/paper -icon-button.html"> |
5 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> | 5 <link rel="import" href="chrome://resources/polymer/v1_0/paper-styles/color.html "> |
6 <link rel="import" href="chrome://bookmarks/actions.html"> | 6 <link rel="import" href="chrome://bookmarks/actions.html"> |
7 <link rel="import" href="chrome://bookmarks/icons.html"> | 7 <link rel="import" href="chrome://bookmarks/icons.html"> |
8 <link rel="import" href="chrome://bookmarks/shared_style.html"> | 8 <link rel="import" href="chrome://bookmarks/shared_style.html"> |
9 <link rel="import" href="chrome://bookmarks/store_client.html"> | 9 <link rel="import" href="chrome://bookmarks/store_client.html"> |
10 | 10 |
11 <dom-module id="bookmarks-folder-node"> | 11 <dom-module id="bookmarks-folder-node"> |
12 <template> | 12 <template> |
13 <style include="shared-style"> | 13 <style include="shared-style"> |
14 :host { | 14 :host { |
15 --padding-start-per-depth: 36px; | |
15 display: block; | 16 display: block; |
16 } | 17 } |
17 | 18 |
18 .v-centered { | 19 .v-centered { |
19 align-items: center; | 20 align-items: center; |
20 display: flex; | 21 display: flex; |
21 flex-direction: row; | 22 flex-direction: row; |
22 } | 23 } |
23 | 24 |
24 .menu-label { | 25 .menu-label { |
25 -webkit-margin-start: 24px; | 26 -webkit-margin-start: 16px; |
26 color: var(--folder-inactive-color); | 27 color: var(--folder-inactive-color); |
27 font-weight: 500; | 28 font-weight: 500; |
28 overflow: hidden; | |
29 text-overflow: ellipsis; | 29 text-overflow: ellipsis; |
tsergeant
2017/03/15 00:07:52
Ellipsizing doesn't seem to work, but it's pretty
calamity
2017/03/15 00:48:19
Done.
| |
30 white-space: nowrap; | 30 white-space: nowrap; |
31 } | 31 } |
32 | 32 |
33 #container { | 33 #container { |
34 -webkit-padding-start: | |
35 calc(var(--node-depth, 0) * var(--padding-start-per-depth)); | |
36 cursor: pointer; | |
34 height: 40px; | 37 height: 40px; |
35 padding-left: calc(var(--node-depth, 0) * 30px); | |
36 } | 38 } |
37 | 39 |
38 #folder-label { | 40 #folder-label { |
41 -webkit-padding-end: 8px; | |
39 color: var(--secondary-text-color); | 42 color: var(--secondary-text-color); |
40 cursor: pointer; | |
41 flex-grow: 1; | 43 flex-grow: 1; |
42 overflow: hidden; | |
43 } | 44 } |
44 | 45 |
45 :host([is-selected-folder_]) .menu-label, | 46 :host([is-selected-folder_]) .menu-label, |
46 :host([is-selected-folder_]) #folder-label { | 47 :host([is-selected-folder_]) #folder-label { |
47 color: var(--folder-active-color); | 48 color: var(--folder-active-color); |
48 } | 49 } |
49 | 50 |
50 iron-icon { | 51 iron-icon { |
51 --iron-icon-height: 20px; | 52 --iron-icon-height: 20px; |
52 --iron-icon-width: 20px; | 53 --iron-icon-width: 20px; |
53 min-width: 20px; | 54 min-width: 20px; |
54 } | 55 } |
55 | 56 |
56 paper-icon-button { | 57 #arrow { |
57 color: var(--secondary-text-color); | 58 color: var(--secondary-text-color); |
58 height: 36px; | 59 height: 36px; |
60 margin: 0 8px; | |
59 min-width: 36px; | 61 min-width: 36px; |
60 padding: 8px; | 62 transform: rotate(-90deg); |
tsergeant
2017/03/15 00:07:52
You'll need to adjust this transform in RTL to +90
calamity
2017/03/15 00:48:19
T_T
| |
63 transition: transform 150ms; | |
61 width: 36px; | 64 width: 36px; |
62 } | 65 } |
66 | |
67 #arrow[is-open] { | |
68 transform: initial; | |
69 } | |
70 | |
71 [no-children] { | |
72 -webkit-padding-start: 52px; /* The width of the arrow and its margin */ | |
73 } | |
63 </style> | 74 </style> |
64 | 75 |
65 <div id="container" class="v-centered"> | 76 <div id="container" class="v-centered" on-tap="selectFolder_"> |
66 <div id="folder-label" class="v-centered" on-tap="selectFolder_"> | 77 <template is="dom-if" if="[[hasChildFolder_(item_.children)]]"> |
67 <iron-icon icon="[[getFolderIcon_(isSelectedFolder_)]]"></iron-icon> | 78 <paper-icon-button id="arrow" icon="cr:arrow-drop-down" |
79 is-open$="[[!isClosed_]]" on-tap="toggleFolder_"> | |
80 </paper-icon-button> | |
81 </template> | |
82 <div id="folder-label" class="v-centered"> | |
83 <iron-icon icon="[[getFolderIcon_(isSelectedFolder_)]]" | |
84 no-children$="[[!hasChildFolder_(item_.children)]]"> | |
85 </iron-icon> | |
68 <div class="menu-label">[[item_.title]]</div> | 86 <div class="menu-label">[[item_.title]]</div> |
69 </div> | 87 </div> |
70 <template is="dom-if" if="[[hasChildFolder_(item_.children)]]"> | |
71 <paper-icon-button icon="[[getArrowIcon_(isClosed_)]]" | |
72 on-tap="toggleFolder_"></paper-icon-button> | |
73 </template> | |
74 </div> | 88 </div> |
75 <div id="descendants" hidden$="[[isClosed_]]"> | 89 <div id="descendants" hidden$="[[isClosed_]]"> |
76 <template is="dom-repeat" | 90 <template is="dom-repeat" |
77 items="[[item_.children]]" | 91 items="[[item_.children]]" |
78 as="child" | 92 as="child" |
79 filter="isFolder_"> | 93 filter="isFolder_"> |
80 <bookmarks-folder-node item-id="[[child]]" | 94 <bookmarks-folder-node item-id="[[child]]" |
81 depth="[[getChildDepth_(depth)]]"> | 95 depth="[[getChildDepth_(depth)]]"> |
82 </bookmarks-folder-node> | 96 </bookmarks-folder-node> |
83 </template> | 97 </template> |
84 </div> | 98 </div> |
85 </template> | 99 </template> |
86 <script src="chrome://bookmarks/folder_node.js"></script> | 100 <script src="chrome://bookmarks/folder_node.js"></script> |
87 </dom-module> | 101 </dom-module> |
OLD | NEW |