kopia lustrzana https://github.com/wagtail/wagtail
				
				
				
			Reveal section on minimap click
							rodzic
							
								
									1c27af0618
								
							
						
					
					
						commit
						6a8096bdb8
					
				|  | @ -8,6 +8,7 @@ import React, { | |||
| 
 | ||||
| import { debounce } from '../../utils/debounce'; | ||||
| import { gettext } from '../../utils/gettext'; | ||||
| import { toggleCollapsiblePanel } from '../../includes/panels'; | ||||
| import Icon from '../Icon/Icon'; | ||||
| 
 | ||||
| import CollapseAll from './CollapseAll'; | ||||
|  | @ -127,11 +128,13 @@ const Minimap: React.FunctionComponent<MinimapProps> = ({ | |||
|   const listRef = useRef<HTMLOListElement>(null); | ||||
| 
 | ||||
|   const onClickToggle = () => toggleMinimap(!expanded); | ||||
|   const onClickLink = (e: React.MouseEvent) => { | ||||
|   const onClickLink = (link: MinimapMenuItem, e: React.MouseEvent) => { | ||||
|     // Prevent navigating if the link is only partially shown.
 | ||||
|     if (!expanded) { | ||||
|       e.preventDefault(); | ||||
|     } | ||||
| 
 | ||||
|     toggleCollapsiblePanel(link.toggle, true); | ||||
|     toggleMinimap(true); | ||||
|   }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -19,7 +19,7 @@ interface MinimapItemProps { | |||
|   item: MinimapMenuItem; | ||||
|   intersects: boolean; | ||||
|   expanded: boolean; | ||||
|   onClick: (e: React.MouseEvent) => void; | ||||
|   onClick: (item: MinimapMenuItem, e: React.MouseEvent) => void; | ||||
| } | ||||
| 
 | ||||
| const requiredMark = <span className="w-required-mark">*</span>; | ||||
|  | @ -47,7 +47,7 @@ const MinimapItem: React.FunctionComponent<MinimapItemProps> = ({ | |||
|       className={`w-minimap-item w-minimap-item--${level} ${ | ||||
|         intersects ? 'w-minimap-item--active' : '' | ||||
|       } ${hasError ? 'w-minimap-item--error' : ''}`}
 | ||||
|       onClick={onClick} | ||||
|       onClick={onClick.bind(null, item)} | ||||
|       aria-current={intersects} | ||||
|       // Prevent interacting with the links when they are only partially shown.
 | ||||
|       tabIndex={expanded ? undefined : -1} | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Thibaud Colas
						Thibaud Colas