mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix right button
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
This commit is contained in:
parent
f484620ebb
commit
61345aaf72
@ -27,7 +27,7 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) =
|
||||
const scrollStep = 200;
|
||||
|
||||
const scrollToRight = (): void => {
|
||||
if(!elem) return;
|
||||
if(!elem || scrollPosition + scrollStep > contentWidth) return;
|
||||
const scroll = scrollPosition + scrollStep;
|
||||
|
||||
setScrollPosition(scroll);
|
||||
@ -35,7 +35,6 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) =
|
||||
elem.current.scrollLeft = scroll;
|
||||
};
|
||||
|
||||
|
||||
const scrollToLeft = (): void => {
|
||||
if(!elem) return;
|
||||
const scroll = scrollPosition - scrollStep;
|
||||
@ -57,7 +56,7 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) =
|
||||
return scrollPosition > scrollStep;
|
||||
};
|
||||
|
||||
const updateScrollPosition = ( evt: UIEvent<HTMLDivElement>) => {
|
||||
const updateScrollPosition = ( evt: UIEvent<HTMLDivElement>): void => {
|
||||
const position = evt.currentTarget.scrollLeft;
|
||||
|
||||
if (position!== undefined) {
|
||||
@ -65,7 +64,7 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) =
|
||||
}
|
||||
};
|
||||
|
||||
const onWindowResize = () => {
|
||||
const onWindowResize = (): void => {
|
||||
if(!elem || !contentElem) return;
|
||||
|
||||
setContentWidth(contentElem.current.clientWidth);
|
||||
@ -108,7 +107,7 @@ export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: Props) =
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div style={{ overflow: "hidden" }} className={"flex gaps align-center"}>
|
||||
<div className={"tabs-wrapper flex gaps align-center"}>
|
||||
{isScrollableLeft() && (
|
||||
<Icon
|
||||
material="keyboard_arrow_left"
|
||||
|
||||
@ -58,6 +58,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
.tabs-wrapper {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tab-content {
|
||||
position: relative;
|
||||
flex: 1;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user