mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
Use buttons for rail tabs (#31133)
GitOrigin-RevId: 9f251969ed0f88a32f8bf706a6320c4c81c6d000
This commit is contained in:
@@ -6,7 +6,7 @@ import { NavLink } from 'react-bootstrap'
|
|||||||
import { RailElement } from '@/features/ide-react/util/rail-types'
|
import { RailElement } from '@/features/ide-react/util/rail-types'
|
||||||
|
|
||||||
const RailTab = forwardRef<
|
const RailTab = forwardRef<
|
||||||
HTMLAnchorElement,
|
HTMLButtonElement,
|
||||||
{
|
{
|
||||||
icon: RailElement['icon']
|
icon: RailElement['icon']
|
||||||
eventKey?: string
|
eventKey?: string
|
||||||
@@ -14,7 +14,7 @@ const RailTab = forwardRef<
|
|||||||
indicator?: ReactElement
|
indicator?: ReactElement
|
||||||
title: string
|
title: string
|
||||||
} & ComponentProps<'button'>
|
} & ComponentProps<'button'>
|
||||||
>(({ icon, eventKey, className, open, indicator, title, ...props }, ref) => {
|
>(({ icon, className, eventKey, open, indicator, title, ...props }, ref) => {
|
||||||
return (
|
return (
|
||||||
<OLTooltip
|
<OLTooltip
|
||||||
id={`rail-tab-tooltip-${eventKey}`}
|
id={`rail-tab-tooltip-${eventKey}`}
|
||||||
@@ -28,6 +28,7 @@ const RailTab = forwardRef<
|
|||||||
className={classNames('ide-rail-tab-link', className, {
|
className={classNames('ide-rail-tab-link', className, {
|
||||||
'open-rail': open,
|
'open-rail': open,
|
||||||
})}
|
})}
|
||||||
|
as="button"
|
||||||
>
|
>
|
||||||
<RailTabIcon icon={icon} title={title} open={open} />
|
<RailTabIcon icon={icon} title={title} open={open} />
|
||||||
{indicator}
|
{indicator}
|
||||||
|
|||||||
@@ -52,8 +52,8 @@ const moduleRailPopovers = (
|
|||||||
import: {
|
import: {
|
||||||
default: {
|
default: {
|
||||||
key: string
|
key: string
|
||||||
Component: FC<{ ref: RefObject<HTMLAnchorElement> }>
|
Component: FC<{ ref: RefObject<HTMLButtonElement> }>
|
||||||
ref: RefObject<HTMLAnchorElement>
|
ref: RefObject<HTMLButtonElement>
|
||||||
hide: boolean | (() => boolean)
|
hide: boolean | (() => boolean)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +77,7 @@ export const RailLayout = () => {
|
|||||||
|
|
||||||
const isHistoryView = view === 'history'
|
const isHistoryView = view === 'history'
|
||||||
|
|
||||||
const fileTreeRef = useRef<HTMLAnchorElement>(null)
|
const fileTreeRef = useRef<HTMLButtonElement>(null)
|
||||||
const settingsRef = useRef<HTMLButtonElement>(null)
|
const settingsRef = useRef<HTMLButtonElement>(null)
|
||||||
|
|
||||||
useEventListener(
|
useEventListener(
|
||||||
|
|||||||
@@ -14,6 +14,6 @@ export type RailElement = {
|
|||||||
hide?: boolean | (() => boolean)
|
hide?: boolean | (() => boolean)
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
mountOnFirstLoad?: boolean
|
mountOnFirstLoad?: boolean
|
||||||
ref?: React.RefObject<HTMLAnchorElement>
|
ref?: React.RefObject<HTMLButtonElement>
|
||||||
tab?: typeof RailTab
|
tab?: typeof RailTab
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user