PluginProbe
Code Snippets / 4.0.0-beta.2
Code Snippets v4.0.0-beta.2
4.0.0-beta.2 3.10.2 3.10.1 3.10.0 3.10.0-beta.2 3.10.0-beta.1 4.0.0-beta.1 3.9.6 trunk 2.10.0 2.10.1 2.12.0 2.12.1 2.13.0 2.13.1 2.13.2 2.13.3 2.14.0 2.14.1 2.14.2 2.14.3 2.14.4 2.14.5 2.14.6 3.0.0 All 65 releases
code-snippets / js / components / ManageMenu / BlueprintsDemo / BlueprintSidebar.tsx

BlueprintSidebar.tsx in Code Snippets 4.0.0-beta.2, at js/components/ManageMenu/BlueprintsDemo/BlueprintSidebar.tsx

52 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react'
2 import { __ } from '@wordpress/i18n'
3 import classnames from 'classnames'
4 import { DEMO_SECTIONS } from './demoBlueprint'
5
6 interface BlueprintSidebarProps {
7 activeSection: string
8 browsable: boolean
9 /** Whether the walkthrough is clicking the generate button right now. */
10 generating: boolean
11 onSelect: (id: string) => void
12 }
13
14 export const BlueprintSidebar: React.FC<BlueprintSidebarProps> = ({
15 activeSection,
16 browsable,
17 generating,
18 onSelect
19 }) =>
20 <nav className="blueprint-form-sidebar" aria-label={__('Blueprint sections', 'code-snippets')}>
21 <ul>
22 {DEMO_SECTIONS.map(section => {
23 const isActive = section.id === activeSection
24
25 return (
26 <li key={section.id}>
27 <button
28 type="button"
29 className={classnames('blueprint-form-sidebar__item', { 'is-active': isActive })}
30 aria-current={isActive ? 'step' : undefined}
31 disabled={!browsable}
32 onClick={() => onSelect(section.id)}
33 >
34 <span>{section.title}</span>
35 </button>
36 </li>
37 )
38 })}
39 </ul>
40
41 <div className="blueprint-form-sidebar__generate-wrap">
42 <button
43 type="button"
44 className={classnames('blueprint-form-sidebar__generate', { 'demo-click': generating })}
45 aria-hidden="true"
46 tabIndex={-1}
47 >
48 {__('Generate Code', 'code-snippets')}
49 </button>
50 </div>
51 </nav>
52