Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions frontend/web/components/navigation/TabMenu/TabButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@ interface TabButtonProps {
isSelected: boolean
onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void
buttonTheme?: string
className?: string
child: React.ReactElement
children: React.ReactNode
}

const TabButton = React.forwardRef<HTMLButtonElement | null, TabButtonProps>(
({ buttonTheme, child, className, isSelected, noFocus, onClick }, ref) => {
({ buttonTheme, child, isSelected, noFocus, onClick }, ref) => {
return (
<Button
ref={ref as React.RefObject<HTMLButtonElement>}
Expand All @@ -25,7 +24,7 @@ const TabButton = React.forwardRef<HTMLButtonElement | null, TabButtonProps>(
onClick={(e) => onClick?.(e)}
className={`btn-tab px-2 ${noFocus ? 'btn-no-focus' : ''} ${
isSelected ? ' tab-active' : ''
} ${className}`}
}`}
>
{child.props.tabLabel}
</Button>
Expand Down
13 changes: 7 additions & 6 deletions frontend/web/components/navigation/TabMenu/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,6 @@ const Tabs: React.FC<TabsProps> = ({
() => (disableOverflow ? [] : tabChildren.slice(visibleCount)),
[tabChildren, visibleCount, disableOverflow],
)
const canGrow = !isMeasuring && visibleCount === tabChildren.length

const handleChange = useCallback(
(e: React.MouseEvent<HTMLButtonElement>, tabLabel: string, i: number) => {
e.stopPropagation()
Expand Down Expand Up @@ -138,17 +136,20 @@ const Tabs: React.FC<TabsProps> = ({
>
<div
ref={itemsContainerRef}
className={classNames('d-flex align-items-center flex-1', 'gap-2', {
'opacity-0': isMeasuring,
})}
className={classNames(
'd-flex align-items-center justify-content-evenly flex-1',
'gap-2',
{
'opacity-0': isMeasuring,
},
)}
>
{(isMeasuring ? tabChildren : visible).map((child, i) => {
const isSelected = !isMeasuring && value === i
return (
<TabButton
key={`button-${i}`}
isSelected={isSelected}
className={canGrow ? 'tab-nav-full' : ''}
noFocus={noFocus}
onClick={(e: React.MouseEvent<HTMLButtonElement>) =>
handleChange(
Expand Down
4 changes: 0 additions & 4 deletions frontend/web/styles/components/_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
}

.tabs-nav {
.tab-nav-full {
flex: 1 !important;
}

position: relative;
display: flex;
flex-direction: row;
Expand Down
Loading