Download wp-calypso/client/layout/sidebar/heading.jsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/layout/sidebar/heading.jsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/wp-calypso/client/layout/sidebar/heading.jsx
-
curl -L -o heading.jsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/wp-calypso/client/layout/sidebar/heading.jsx
742 Bytes
| const SidebarHeading = ( { children, onClick, ...props } ) => { | |
| const tabIndex = onClick ? 0 : -1; | |
| let onKeyDown = null; | |
| if ( onClick ) { | |
| onKeyDown = ( event ) => { | |
| // Trigger click for enter, similarly to default brower behavior for <a> or <button> | |
| if ( 13 === event.keyCode ) { | |
| event.preventDefault(); | |
| onClick(); | |
| } | |
| }; | |
| } | |
| // Exclude invalid HTML attributes | |
| const { navigationLabel, url, ...linkAttrs } = props; | |
| return ( | |
| <li> | |
| { /* eslint-disable jsx-a11y/no-static-element-interactions */ } | |
| <a | |
| tabIndex={ tabIndex } | |
| className="sidebar__heading" | |
| onKeyDown={ onKeyDown } | |
| onClick={ onClick } | |
| { ...linkAttrs } | |
| > | |
| { children } | |
| </a> | |
| </li> | |
| ); | |
| }; | |
| export default SidebarHeading; | |