diff --git a/playroom/snippets.tsx b/playroom/snippets.tsx index 64ee5a871..5a6e16ad4 100644 --- a/playroom/snippets.tsx +++ b/playroom/snippets.tsx @@ -2409,10 +2409,24 @@ const navigationBarSnippets = [ name: 'MainNavigationBar', code: ` ({ - title, - onPress: () => setState("index", idx), - }))} + sections={[ + { + title: "Start", + onPress: () => setState("index", 0), + }, + { + title: "Account", + onPress: () => setState("index", 1), + }, + { + title: "Explore", + onPress: () => setState("index", 2), + }, + { + title: "Support", + onPress: () => setState("index", 3), + }, + ]} selectedIndex={getState("index", 0)} right={ @@ -2441,70 +2455,75 @@ const navigationBarSnippets = [ name: 'MainNavigationBar with menu', code: ` ({ - onPress: () => setState("index", idx), - title, - menu: - title === "Start" - ? { - columns: [ + sections={[ + { + onPress: () => setState("index", 0), + title: "Start", + menu: { + columns: [ + { + title: "Start 1", + items: [ + { + title: "item 1", + onPress: () => {}, + }, + { + title: "item 2", + href: "https://www.google.com/", + }, { - title: \`\${title} 1\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - { - title: "item 2", - href: "https://www.google.com/", - }, - { - title: "item 3", - to: "#", - }, - ], + title: "item 3", + to: "#", }, ], - } - : title === "Account" - ? { - columns: [ + }, + ], + }, + }, + { + onPress: () => setState("index", 1), + title: "Account", + menu: { + columns: [ + { + title: "Account 1", + items: [ { - title: \`\${title} 1\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - ], + title: "item 1", + onPress: () => {}, }, ], - } - : title === "Explore" - ? { - columns: [ + }, + ], + }, + }, + { + onPress: () => setState("index", 2), + title: "Explore", + menu: { + columns: [ + { + title: "Explore 1", + items: [ + { + title: "item 1", + onPress: () => {}, + }, + { + title: "item 2", + href: "https://www.google.com/", + }, { - title: \`\${title} 1\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - { - title: "item 2", - href: "https://www.google.com/", - }, - { - title: "item 3", - to: "#", - }, - ], + title: "item 3", + to: "#", }, ], - } - : undefined, - }))} + }, + ], + }, + }, + ]} selectedIndex={getState("index", 0)} />`, }, @@ -2514,143 +2533,151 @@ const navigationBarSnippets = [ code: ` ({ - onPress: () => setState("index", idx), - title, - menu: - title === "Start" - ? { - columns: [ + sections={[ + { + onPress: () => setState("index", 0), + title: "Start", + menu: { + columns: [ + { + title: "Start 1", + items: [ + { + title: "item 1", + onPress: () => {}, + }, { - title: \`\${title} 1\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - { - title: "item 2", - href: "https://www.google.com/", - }, - { - title: "item 3", - to: "#", - }, - ], + title: "item 2", + href: "https://www.google.com/", }, { - title: \`\${title} 2\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - { - title: "item 2", - href: "https://www.google.com/", - }, - { - title: "item 3", - to: "#", - }, - ], + title: "item 3", + to: "#", }, ], - } - : title === "Account" - ? { - columns: [ + }, + { + title: "Start 2", + items: [ + { + title: "item 1", + onPress: () => {}, + }, { - title: \`\${title} 1\`, - items: [ - { - title: "item 1", - onPress: () => {}, - }, - ], + title: "item 2", + href: "https://www.google.com/", + }, + { + title: "item 3", + to: "#", }, ], - } - : title === "Explore" - ? { - content: ({ closeMenu }) => ( - - Custom content - - Close menu - - ), - } - : title === "Support" - ? { - content: isDesktopOrBigger ? ( - - {Array.from({ length: 3 }, (_, index) => ( - - - Contenidos - - {[ - "Destacados", - "Todo fútbol", - "#0", - "Cine", - "Oferta comercial", - "Mi Movistar", - "Movistar Cloud", - ].map((title, index) => ( - {}} - style={{ color: colors.textPrimary }} - > - {title} - - ))} - - - - ))} - - - Oferta} - title="Movistar Plus+" - onPress={() => {}} - description="Contrata solo TV por 9,99 €" - backgroundImage="${imagePlaceholder}" - /> - - - ) : ( - - {Array.from({ length: 3 }, (_, index) => ( - - Title - - - {}} /> - {}} /> - {}} /> - {}} /> - - + }, + ], + }, + }, + { + onPress: () => setState("index", 1), + title: "Account", + menu: { + columns: [ + { + title: "Account 1", + items: [ + { + title: "item 1", + onPress: () => {}, + }, + ], + }, + ], + }, + }, + { + onPress: () => setState("index", 2), + title: "Explore", + menu: { + content: ({ closeMenu }) => ( + + Custom content + + Close menu + + ), + }, + }, + { + onPress: () => setState("index", 3), + title: "Support", + menu: { + content: isDesktopOrBigger ? ( + + {Array.from({ length: 3 }, (_, index) => ( + + + Contenidos + + {[ + "Destacados", + "Todo fútbol", + "#0", + "Cine", + "Oferta comercial", + "Mi Movistar", + "Movistar Cloud", + ].map((title, index) => ( + {}} + style={{ color: colors.textPrimary }} + > + {title} + + ))} - ))} + + + ))} - Oferta} - title="Movistar Plus+" - aspectRatio="1:1" - onPress={() => {}} - description="Contrata solo TV por 9,99 €" - backgroundImage="${imagePlaceholder}" - /> + + Oferta} + title="Movistar Plus+" + onPress={() => {}} + description="Contrata solo TV por 9,99 €" + backgroundImage="${imagePlaceholder}" + /> + + + ) : ( + + {Array.from({ length: 3 }, (_, index) => ( + + Title + + + {}} /> + {}} /> + {}} /> + {}} /> + + - ), - } - : undefined, - }))} + ))} + + Oferta} + title="Movistar Plus+" + aspectRatio="1:1" + onPress={() => {}} + description="Contrata solo TV por 9,99 €" + backgroundImage="${imagePlaceholder}" + /> + + ), + }, + }, + ]} selectedIndex={getState("index", 0)} />`, },