-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: storybook hooks docs #1010
Closed
Closed
Changes from 13 commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
7b56f48
fix: remove unused @param peerId from jsdoc
zakybilfagih 26c42a8
fix: export pagination component from story
zakybilfagih 98e22e3
fix: role should be roleName
zakybilfagih c2585cc
feat: add fake role on fake store
zakybilfagih 86b5b26
feat: add more stub on storybooksdk reactsdk stub
zakybilfagih d0b9e72
feat: useAVToggle hook example
zakybilfagih 8ad1b1c
feat: useCustomEvent example
zakybilfagih 3611ad5
feat: useRemoteAVToggle example
zakybilfagih 2b9148c
feat: useVideo example
zakybilfagih 48703b7
feat: useVideoList example
zakybilfagih 0c9ac1f
fix: useState dependency array errors
zakybilfagih 2337b7c
fix: add type to custom event message
zakybilfagih 8a37720
fix: remove unused block statement
zakybilfagih 5e2049f
fix: move hooks stories to seperate folder
zakybilfagih 233a82b
fix: move mdx file
zakybilfagih eec1050
feat: add useDevices hook
zakybilfagih e405300
feat: add useScreenShare hook
zakybilfagih 6c619b0
feat: docs for av toogle
amar-1995 aaf15cd
fix: try to resolve hooks error (still not working)
zakybilfagih 7b8fe39
feat: av toggle updated docs
amar-1995 3f80c31
fix: minor fixes
zakybilfagih 7160974
fix: change text variant screenshare story
zakybilfagih e8ed15b
feat: add useParticipants hook
zakybilfagih 6fe8627
fix: merge with latest remote
zakybilfagih 32d9cd4
feat: add useVideo docs
zakybilfagih 4ae95f3
feat: added interface to useAVToggle hook
zakybilfagih 76026fe
feat: add useVideoList mdx
zakybilfagih db509e3
fix: move example above code snippet
zakybilfagih 6478dae
feat: add useScreenShare mdx
zakybilfagih 5d04c96
feat: add useDevices mdx
zakybilfagih 19cefb0
feat: add useCustomEvent mdx
zakybilfagih 7dabc0f
fix: updated and revert useAVToggle mdx
zakybilfagih ec71727
feat: stub foir useAutoPlayError hook
zakybilfagih 254d4c4
feat: added docs of use participants
amar-1995 513de1a
feat: added docs block in stories
amar-1995 6432ff2
feat: added story for useautoplayError
amar-1995 23ddb19
feat: lint fix story for useautoplayError
amar-1995 d7c5b45
feat: docs update for remote av
amar-1995 180cbb3
feat: added stub storybook notification
zakybilfagih b3fb00e
feat: useAutoplayError
zakybilfagih 0b0a4ec
fix: minor changes
zakybilfagih fd7eb53
fix: make icon name uniform
zakybilfagih 8db3ace
fix: prettier error
zakybilfagih 4cbfa39
fix: remove ts-ignore
zakybilfagih 6546dbc
fix: av toogle docs update
amar-1995 d1e5edd
feat: added docs for useaudioLevelStyles
amar-1995 f9de301
feat: added docs for usePreviewjoin
amar-1995 ad9ab67
fix: minor style changes
zakybilfagih dd18ecf
feat: added stub for useAudioLevelStyles
zakybilfagih f6a7002
feat: added stub for usePreviewJoin
zakybilfagih 6abffc5
fix: update mdx to current example
zakybilfagih 984f7d6
fix: add the definition of DialogContent
zakybilfagih 4641223
fix: wrap function in useCallback
zakybilfagih 51a9d30
feat: added css reset on storybook entry file
zakybilfagih 233cd62
fix: remove previous css on pagination
zakybilfagih bbd08cb
fix: added default font on select component
zakybilfagih d5956a5
fix: move pagination, center story
zakybilfagih 0721770
fix: video list remove overflow
zakybilfagih 91289df
fix: theme map merging
zakybilfagih 0ff2f24
fix: remove value from effect deps
zakybilfagih 89bfbd7
fix: fix not adding className
zakybilfagih 0f31e86
Merge branch 'main' into feat/storybook-hooks
zakybilfagih 4ebeb83
fix: dark mode styling issue
zakybilfagih 7369a18
fix: eslint rule and prettier error
zakybilfagih a74dd6e
fix: try removing base css
zakybilfagih e8cb426
fix: change merging strategy
zakybilfagih File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { selectLocalVideoTrackID, useAVToggle, useHMSStore } from '@100mslive/react-sdk'; | ||
import Video, { StyledVideo } from './Video'; | ||
import React from 'react'; | ||
import { ComponentStory } from '@storybook/react'; | ||
|
||
const VideoHook: ComponentStory<typeof StyledVideo> = () => { | ||
const localVideoTrackID = useHMSStore(selectLocalVideoTrackID); | ||
const { isLocalVideoEnabled, isLocalAudioEnabled, toggleVideo, toggleAudio } = useAVToggle(); | ||
|
||
return ( | ||
<div> | ||
<button onClick={() => toggleVideo && toggleVideo()}> | ||
{isLocalVideoEnabled ? 'Disable video' : 'Enable video'} | ||
</button> | ||
<button onClick={() => toggleAudio && toggleAudio()}> | ||
{isLocalAudioEnabled ? 'Disable audio' : 'Enable audio'} | ||
</button> | ||
<Video css={{ bg: '$backgroundDark' }} trackId={localVideoTrackID} /> | ||
</div> | ||
); | ||
}; | ||
|
||
const VideoStories = { | ||
title: 'Hooks/useAVToggle', | ||
component: VideoHook, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
}; | ||
|
||
export default VideoStories; | ||
|
||
export const UseVideoHook = VideoHook.bind({}); | ||
UseVideoHook.storyName = 'useAVToggle'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { StyledVideo } from './Video'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file should be wherever the component is ideally. does it not come under the same section? if not let's create a separate folder for all hooks. |
||
import { ComponentStory } from '@storybook/react'; | ||
import { useCustomEvent } from '@100mslive/react-sdk'; | ||
import { useCallback, useState } from 'react'; | ||
import { Toast } from '../Toast'; | ||
|
||
const VideoHook: ComponentStory<typeof StyledVideo> = () => { | ||
const [open, setOpen] = useState(false); | ||
const [data, setData] = useState<{ emoji: string }>(); | ||
|
||
const handleEmojiReaction = useCallback((data: { emoji: string }) => { | ||
setOpen(true); | ||
setData(data); | ||
}, []); | ||
|
||
const { sendEvent } = useCustomEvent({ | ||
type: 'EMOJI_REACTION', | ||
onEvent: handleEmojiReaction, | ||
}); | ||
|
||
return ( | ||
<Toast.Provider> | ||
<button onClick={() => sendEvent({ emoji: '🚀' })}>Rockets</button> | ||
<Toast.HMSToast | ||
title="EMOJI_REACTION" | ||
description={JSON.stringify(data)} | ||
open={open} | ||
isClosable={true} | ||
onOpenChange={o => setOpen(o)} | ||
/> | ||
<Toast.Viewport css={{ bottom: '$24' }} /> | ||
</Toast.Provider> | ||
); | ||
}; | ||
|
||
const VideoStories = { | ||
title: 'Hooks/useCustomEvent', | ||
component: VideoHook, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
}; | ||
|
||
export default VideoStories; | ||
|
||
export const UseVideoHook = VideoHook.bind({}); | ||
UseVideoHook.storyName = 'useCustomEvent'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useRemoteAVToggle } from '@100mslive/react-sdk'; | ||
import Video, { StyledVideo } from './Video'; | ||
import React from 'react'; | ||
import { ComponentStory } from '@storybook/react'; | ||
|
||
const VideoHook: ComponentStory<typeof StyledVideo> = () => { | ||
const videoTrackId = '104'; | ||
const { isVideoEnabled, isAudioEnabled, toggleVideo, toggleAudio } = useRemoteAVToggle('1', videoTrackId); | ||
|
||
return ( | ||
<div> | ||
<button onClick={() => toggleVideo && toggleVideo()}>{isVideoEnabled ? 'Disable video' : 'Enable video'}</button> | ||
<button onClick={() => toggleAudio && toggleAudio()}>{isAudioEnabled ? 'Disable audio' : 'Enable audio'}</button> | ||
<Video css={{ bg: '$backgroundDark' }} trackId={videoTrackId} /> | ||
</div> | ||
); | ||
}; | ||
|
||
const VideoStories = { | ||
title: 'Hooks/useRemoteAVToggle', | ||
component: VideoHook, | ||
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes | ||
}; | ||
|
||
export default VideoStories; | ||
|
||
export const UseVideoHook = VideoHook.bind({}); | ||
UseVideoHook.storyName = 'useRemoteAVToggle'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.mdx would be needed for each hook. adding here just in case you missed this.