Skip to content

Commit b8140df

Browse files
formatting
1 parent 0d8d90a commit b8140df

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

lib/components/tab.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {forwardRef, useEffect, useImperativeHandle, useRef} from 'react';
1+
import React, {useEffect, useRef} from 'react';
22

33
import type {TabProps} from '../../typings/hyper';
44

@@ -24,10 +24,10 @@ const Tab = (props: TabProps) => {
2424
useEffect(() => {
2525
if (props.lastFocused) {
2626
ref?.current?.scrollIntoView({
27-
behavior: "smooth"
28-
})
27+
behavior: 'smooth'
28+
});
2929
}
30-
}, [props.lastFocused,])
30+
}, [props.lastFocused]);
3131

3232
const {isActive, isFirst, isLast, borderColor, hasActivity} = props;
3333

lib/components/tabs.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, {forwardRef, useEffect, useState} from 'react';
2+
23
import debounce from 'lodash/debounce';
34

45
import type {ITab, TabsProps} from '../../typings/hyper';
@@ -15,20 +16,20 @@ const Tabs = forwardRef<HTMLElement, TabsProps>((props, ref) => {
1516

1617
const [shouldFocusCounter, setShouldFocusCounter] = useState({
1718
index: 0,
18-
when: undefined as (Date | undefined)
19+
when: undefined as Date | undefined
1920
});
2021

21-
const scrollToActiveTab = debounce((tabs: ITab[]) => {
22-
const activeTab = tabs.findIndex(t => t.isActive);
22+
const scrollToActiveTab = debounce((currTabs: ITab[]) => {
23+
const activeTab = currTabs.findIndex((t) => t.isActive);
2324
setShouldFocusCounter({
2425
index: activeTab,
2526
when: new Date()
26-
})
27+
});
2728
}, 100);
2829

2930
useEffect(() => {
30-
scrollToActiveTab(tabs)
31-
}, [tabs, tabs.length])
31+
scrollToActiveTab(tabs);
32+
}, [tabs, tabs.length]);
3233

3334
const hide = !isMac && tabs.length === 1;
3435

@@ -50,7 +51,7 @@ const Tabs = forwardRef<HTMLElement, TabsProps>((props, ref) => {
5051
hasActivity,
5152
onSelect: onChange.bind(null, uid),
5253
onClose: onClose.bind(null, uid),
53-
lastFocused: undefined as (Date | undefined),
54+
lastFocused: undefined as Date | undefined
5455
});
5556
if (shouldFocusCounter.index === i) {
5657
tabProps.lastFocused = shouldFocusCounter.when;
@@ -110,7 +111,8 @@ const Tabs = forwardRef<HTMLElement, TabsProps>((props, ref) => {
110111
overflow-x: auto;
111112
}
112113
113-
.tabs_list::-webkit-scrollbar, .tabs_list::-webkit-scrollbar-button {
114+
.tabs_list::-webkit-scrollbar,
115+
.tabs_list::-webkit-scrollbar-button {
114116
display: none;
115117
}
116118

0 commit comments

Comments
 (0)