diff --git a/example/storybook-nativewind/.storybook/preview.js b/example/storybook-nativewind/.storybook/preview.js index c89f7f123..49e5b04b0 100644 --- a/example/storybook-nativewind/.storybook/preview.js +++ b/example/storybook-nativewind/.storybook/preview.js @@ -108,6 +108,8 @@ export const parameters = { [ 'Recipes', ['Linear Gradient'], + 'Tutorials', + ['Building Ecommerce App'], 'More', [ 'Upgrade to v2', diff --git a/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/index.nw.stories.mdx b/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/index.nw.stories.mdx new file mode 100644 index 000000000..2fc43fe4d --- /dev/null +++ b/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/index.nw.stories.mdx @@ -0,0 +1,12 @@ +--- +title: Learn to build Ecommerce App using gluestack + +description: Tutorial to build Ecommerce App using gluestack-ui from Youtube guru notJust.dev (Vadim) +--- + +import { Canvas, Meta, Story } from '@storybook/addon-docs'; +import VadimStream from './vadim-stream'; + + + + diff --git a/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/vadim-stream.tsx b/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/vadim-stream.tsx new file mode 100644 index 000000000..5fc63fe39 --- /dev/null +++ b/example/storybook-nativewind/src/guides/tutorials/Building Ecommerce App/vadim-stream.tsx @@ -0,0 +1,103 @@ +'use client'; +import React from 'react'; +import { Text } from '@/components/ui/text'; +import { Heading } from '@/components/ui/heading'; +import { VStack } from '@/components/ui/vstack'; +import { HStack } from '@/components/ui/hstack'; +import { Box } from '@/components/ui/box'; +import { useEffect } from 'react'; +import { Span } from '@expo/html-elements'; + +declare global { + interface Window { + onYouTubeIframeAPIReady: () => void; + YT: any; + } +} + +const VadimStream = () => { + useEffect(() => { + let player1: any = null; + let player2: any = null; + + // Load the IFrame Player API code asynchronously + const loadYouTubeAPI = () => { + const tag = document.createElement('script'); + tag.src = 'https://www.youtube.com/iframe_api'; + const firstScriptTag = document.getElementsByTagName('script')[0]; + firstScriptTag.parentNode?.insertBefore(tag, firstScriptTag); + }; + + // This function creates an