Segmented control switching the main stage between storyboard and preview.
()
| 148 | |
| 149 | /** Segmented control switching the main stage between storyboard and preview. */ |
| 150 | function ViewModeToggle() { |
| 151 | const { viewMode, setViewMode } = useViewMode(); |
| 152 | return ( |
| 153 | <div |
| 154 | className="flex items-center gap-0.5 rounded-md bg-neutral-800 p-0.5" |
| 155 | role="tablist" |
| 156 | aria-label="Studio view" |
| 157 | > |
| 158 | {VIEW_MODE_OPTIONS.map(({ mode, label }) => { |
| 159 | const active = viewMode === mode; |
| 160 | return ( |
| 161 | <button |
| 162 | key={mode} |
| 163 | type="button" |
| 164 | role="tab" |
| 165 | aria-selected={active} |
| 166 | onClick={() => { |
| 167 | if (active) return; |
| 168 | trackStudioEvent("view_mode_toggle", { mode }); |
| 169 | setViewMode(mode); |
| 170 | }} |
| 171 | className={`rounded px-3 py-1 text-[11px] font-medium transition-colors ${ |
| 172 | active ? "bg-neutral-200 text-neutral-900" : "text-neutral-400 hover:text-neutral-200" |
| 173 | }`} |
| 174 | > |
| 175 | {label} |
| 176 | </button> |
| 177 | ); |
| 178 | })} |
| 179 | </div> |
| 180 | ); |
| 181 | } |
| 182 | |
| 183 | // fallow-ignore-next-line complexity |
| 184 | export function StudioHeader({ |
nothing calls this directly
no test coverage detected