Skip to content

Commit 2b1f396

Browse files
committed
display tab pinned status
1 parent c8f5823 commit 2b1f396

File tree

4 files changed

+34
-6
lines changed

4 files changed

+34
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vertical-tabs-chrome-extension",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "A chrome extension that presents your tabs vertically.",
55
"license": "MIT",
66
"repository": {

src/pages/Sidebar/Sidebar.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class Sidebar extends Component {
9898
faviconUrl: tab.faviconUrl,
9999
title: tab.title,
100100
url: tab.url,
101+
pinned: tab.pinned,
101102
status: 'complete',
102103
combinedText: [
103104
tab.title, // title
@@ -111,7 +112,6 @@ class Sidebar extends Component {
111112
id: tab.id,
112113
index: tab.index,
113114
active: tab.active,
114-
pinned: tab.pinned,
115115
muted: tab.muted,
116116
});
117117
if (tab.active) {
@@ -120,7 +120,6 @@ class Sidebar extends Component {
120120
id: tab.id,
121121
index: tab.index,
122122
active: tab.active,
123-
pinned: tab.pinned,
124123
muted: tab.muted,
125124
},
126125
});
@@ -153,6 +152,7 @@ class Sidebar extends Component {
153152
faviconUrl: favicon,
154153
title: tab.title,
155154
url: tab.url,
155+
pinned: tab.pinned,
156156
status: tab.status,
157157
combinedText: [
158158
tab.title, // title
@@ -182,7 +182,6 @@ class Sidebar extends Component {
182182
id: tab.id,
183183
index: tab.index,
184184
active: tab.active,
185-
pinned: tab.pinned,
186185
muted: tab.muted,
187186
};
188187
tabOrders.push(tabObj);
@@ -201,7 +200,12 @@ class Sidebar extends Component {
201200
};
202201

203202
handleTabUpdated = (tabId, changes, tab) => {
204-
if (changes.status === 'complete' || changes.title) {
203+
if (
204+
changes.status === 'complete' ||
205+
changes.title ||
206+
changes.pinned === true ||
207+
changes.pinned === false
208+
) {
205209
this.updateTabsDictWithTab(tab, getFavicon(tab.url));
206210
if (changes.status === 'complete') {
207211
setTimeout(() => {

src/pages/Sidebar/containers/TabsList/Tab/Tab.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
/* border-radius: 6px; */
4747

4848
transition: 0.1s all ease-in;
49+
50+
position: relative;
4951
}
5052

5153
.ActiveTabContainer {
@@ -56,6 +58,22 @@
5658
background-color: rgb(244, 245, 247);
5759
}
5860

61+
.PinnedIconContainer {
62+
position: absolute;
63+
top: -3px;
64+
left: 1px;
65+
padding-left: 1px;
66+
padding-top: 0px;
67+
}
68+
69+
.PinnedIcon {
70+
width: 8px;
71+
height: 8px;
72+
opacity: 0.7;
73+
color: rgb(66, 66, 66);
74+
transform: rotate(-45deg);
75+
}
76+
5977
.TabFaviconContainer {
6078
flex-shrink: 0;
6179
margin-right: 8px;

src/pages/Sidebar/containers/TabsList/Tab/Tab.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ContextMenu, MenuItem, ContextMenuTrigger } from 'react-contextmenu';
88

99
import { MdClose } from 'react-icons/md';
1010
import { MdRefresh } from 'react-icons/md';
11+
import { FaThumbtack } from 'react-icons/fa';
1112

1213
import './Tab.css';
1314

@@ -174,7 +175,12 @@ const Tab = ({
174175
: null,
175176
].join(' ')}
176177
>
177-
{/* <div className="Ordinal">{tabOrder.index + 1}</div> */}
178+
{pinned && (
179+
<div className="PinnedIconContainer">
180+
<FaThumbtack className="PinnedIcon" />
181+
</div>
182+
)}
183+
178184
<div className="TabFaviconContainer">
179185
{status === 'loading' ? (
180186
<Loader

0 commit comments

Comments
 (0)