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 / common / demo / DemoCallout.tsx

DemoCallout.tsx in Code Snippets 4.0.0-beta.2, at js/components/common/demo/DemoCallout.tsx

27 lines 944 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from 'react'
2
3 export interface CalloutContent {
4 step: string
5 title: string
6 body: string
7 }
8
9 /**
10 * Commentary on what a walkthrough is doing at the current stage, floating in
11 * the corner of the viewport so it stays out of the page's flow.
12 *
13 * The demo pages announce each stage through their own live region, so this is
14 * hidden from assistive technology rather than repeating it.
15 */
16 export const DemoCallout: React.FC<{ callout?: CalloutContent }> = ({ callout }) =>
17 callout
18 // Keyed on the content rather than the stage: consecutive stages can
19 // share a callout, and remounting between them replays the entrance
20 // animation as a flicker.
21 ? <aside key={callout.title} className="demo-callout" aria-hidden="true">
22 <span className="demo-callout__step">{callout.step}</span>
23 <h3 className="demo-callout__title">{callout.title}</h3>
24 <p className="demo-callout__body">{callout.body}</p>
25 </aside>
26 : null
27