File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,19 @@ const guessTabType = tabNames => {
16
16
const TabbedCode = ( { className, examples, height } ) => {
17
17
const [ codeTabs , setCodeTabs ] = useContext ( CodeTabContext ) || useState ( { unknown : 0 } )
18
18
const tabType = guessTabType ( examples . map ( example => example . name ) )
19
- const exampleIndex = examples . findIndex ( example => codeTabs [ tabType ] === example . name )
19
+ const exampleIndex = examples . findIndex ( example => {
20
+ if ( codeTabs [ tabType ] === example . name ) {
21
+ return true
22
+ }
23
+
24
+ if (
25
+ ( codeTabs [ tabType ] ?. startsWith ( 'Svelte' ) && example . name === 'Svelte' ) ||
26
+ ( codeTabs [ tabType ] === 'Svelte' && example . name . startsWith ( 'Svelte' ) )
27
+ ) {
28
+ // Svelte example are named either 'Svelte', 'Svelte 4', or 'Svelte 5'
29
+ return true
30
+ }
31
+ } )
20
32
const activeTab = exampleIndex < 0 ? 0 : exampleIndex
21
33
22
34
return (
You can’t perform that action at this time.
0 commit comments