@100mslive/roomkit-react 0.4.2 → 0.4.3-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.css +2 -2
- package/dist/index.cjs.css.map +1 -1
- package/dist/index.cjs.js +25 -5
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.css +2 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +25 -5
- package/dist/index.js.map +2 -2
- package/dist/meta.cjs.json +14 -14
- package/dist/meta.esbuild.json +14 -14
- package/package.json +8 -20
- package/src/Accordion/Accordion.stories.tsx +0 -50
- package/src/Avatar/Avatar.stories.tsx +0 -33
- package/src/Button/Button.mdx +0 -43
- package/src/Button/Button.stories.tsx +0 -52
- package/src/Chat/Chat.mdx +0 -39
- package/src/Chat/Chat.stories.tsx +0 -39
- package/src/Checkbox/Checkbox.stories.tsx +0 -61
- package/src/Divider/HorizontalDivider.stories.tsx +0 -34
- package/src/Divider/VerticalDivider.stories.tsx +0 -40
- package/src/Dropdown/Dropdown.stories.tsx +0 -94
- package/src/Fieldset/Fieldset.stories.tsx +0 -29
- package/src/Footer/Footer.stories.tsx +0 -61
- package/src/Icons/Icons.stories.mdx +0 -10
- package/src/Icons/IconsList.jsx +0 -17
- package/src/Input/Input.stories.tsx +0 -25
- package/src/Input/PasswordInput.stories.tsx +0 -53
- package/src/Introduction/Integrating.stories.mdx +0 -100
- package/src/Introduction/Introduction.stories.mdx +0 -9
- package/src/Link/Link.stories.tsx +0 -18
- package/src/Loading/Loading.mdx +0 -15
- package/src/Loading/Loading.stories.tsx +0 -37
- package/src/Modal/Dialog.mdx +0 -19
- package/src/Modal/Dialog.stories.tsx +0 -68
- package/src/Pagination/StyledPagination.stories.tsx +0 -80
- package/src/Popover/Popover.mdx +0 -9
- package/src/Popover/Popover.stories.tsx +0 -95
- package/src/Prebuilt/Prebuilt.stories.tsx +0 -46
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.stories.tsx +0 -40
- package/src/QRCode/QRCode.mdx +0 -9
- package/src/QRCode/QRCode.stories.tsx +0 -29
- package/src/RadioGroup/RadioGroup.stories.tsx +0 -32
- package/src/ReactSelect/ReactSelect.stories.tsx +0 -83
- package/src/Select/Select.stories.tsx +0 -33
- package/src/Sheet/Sheet.mdx +0 -19
- package/src/Sheet/Sheet.stories.tsx +0 -103
- package/src/Slider/Slider.stories.tsx +0 -21
- package/src/Switch/Switch.mdx +0 -11
- package/src/Switch/Switch.stories.tsx +0 -46
- package/src/Tabs/Tabs.stories.tsx +0 -77
- package/src/Text/Text.stories.tsx +0 -21
- package/src/Theme/Theme.stories.mdx +0 -8
- package/src/Theme/ThemeStory.jsx +0 -56
- package/src/Toast/AppToast.stories.tsx +0 -56
- package/src/Toast/Toast.mdx +0 -19
- package/src/Toast/Toast.stories.tsx +0 -57
- package/src/Tooltip/Tooltip.stories.tsx +0 -62
- package/src/Video/UseVideo.mdx +0 -22
- package/src/Video/UseVideo.stories.tsx +0 -26
- package/src/Video/Video.mdx +0 -24
- package/src/Video/Video.stories.tsx +0 -27
- package/src/VideoList/VideoList.stories.tsx +0 -92
- package/src/VideoTile/VideoTile.mdx +0 -28
- package/src/VideoTile/VideoTile.stories.tsx +0 -32
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useEffect, useState } from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Box } from '../Layout';
|
|
4
|
-
import { Text } from '../Text';
|
|
5
|
-
import { Tabs } from '.';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Tabs',
|
|
9
|
-
component: Tabs.Root,
|
|
10
|
-
argTypes: {
|
|
11
|
-
value: { control: { type: 'text' }, defaultValue: 'tab1' },
|
|
12
|
-
onValueChange: { action: { type: 'click' } },
|
|
13
|
-
orientation: { options: ['horizontal', 'vertical'], defaultValue: 'horizontal', control: { type: 'select' } },
|
|
14
|
-
},
|
|
15
|
-
} as ComponentMeta<typeof Tabs.Root>;
|
|
16
|
-
|
|
17
|
-
const Template: ComponentStory<typeof Tabs.Root> = ({
|
|
18
|
-
value: propValue = '',
|
|
19
|
-
onValueChange: propOnValueChange,
|
|
20
|
-
...rest
|
|
21
|
-
}) => {
|
|
22
|
-
const [value, setValue] = useState('tab1');
|
|
23
|
-
|
|
24
|
-
const handleOnValueChange = useCallback(
|
|
25
|
-
(value: string) => {
|
|
26
|
-
setValue(value);
|
|
27
|
-
if (propOnValueChange) {
|
|
28
|
-
propOnValueChange(value);
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
[propOnValueChange],
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
handleOnValueChange(propValue);
|
|
36
|
-
if (propOnValueChange) {
|
|
37
|
-
propOnValueChange(value);
|
|
38
|
-
}
|
|
39
|
-
}, [handleOnValueChange, propOnValueChange, propValue, value]);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<Tabs.Root
|
|
43
|
-
css={{
|
|
44
|
-
gap: '8px',
|
|
45
|
-
maxWidth: '500px',
|
|
46
|
-
width: 'max-content',
|
|
47
|
-
'&[data-orientation="horizontal"]': { flexDirection: 'column' },
|
|
48
|
-
}}
|
|
49
|
-
value={value}
|
|
50
|
-
onValueChange={handleOnValueChange}
|
|
51
|
-
{...rest}
|
|
52
|
-
>
|
|
53
|
-
<Tabs.List
|
|
54
|
-
aria-label="tabs example"
|
|
55
|
-
css={{ bg: '$background_dim', r: '$1', '&[data-orientation="vertical"]': { flexDirection: 'column' } }}
|
|
56
|
-
>
|
|
57
|
-
<Tabs.Trigger value="tab1">One</Tabs.Trigger>
|
|
58
|
-
<Tabs.Trigger value="tab2">Two</Tabs.Trigger>
|
|
59
|
-
<Tabs.Trigger value="tab3">Three</Tabs.Trigger>
|
|
60
|
-
</Tabs.List>
|
|
61
|
-
<Box css={{ r: '$1', bg: '$surface_brighter' }}>
|
|
62
|
-
<Tabs.Content value="tab1">
|
|
63
|
-
<Text>Tab one content</Text>
|
|
64
|
-
</Tabs.Content>
|
|
65
|
-
<Tabs.Content value="tab2">
|
|
66
|
-
<Text>Tab two content</Text>
|
|
67
|
-
</Tabs.Content>
|
|
68
|
-
<Tabs.Content value="tab3">
|
|
69
|
-
<Text>Tab three content</Text>
|
|
70
|
-
</Tabs.Content>
|
|
71
|
-
</Box>
|
|
72
|
-
</Tabs.Root>
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const Example = Template.bind({});
|
|
77
|
-
Example.storyName = 'Tabs';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Text, textVariants } from './Text';
|
|
4
|
-
|
|
5
|
-
export default {
|
|
6
|
-
title: 'UI Components/Text',
|
|
7
|
-
component: Text,
|
|
8
|
-
argTypes: {
|
|
9
|
-
variant: {
|
|
10
|
-
control: {
|
|
11
|
-
type: 'select',
|
|
12
|
-
options: Object.keys(textVariants),
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
} as ComponentMeta<typeof Text>;
|
|
17
|
-
|
|
18
|
-
const Template: ComponentStory<typeof Text> = args => <Text {...args}>The Evil Rabbit jumps.</Text>;
|
|
19
|
-
|
|
20
|
-
export const Playground = Template.bind({});
|
|
21
|
-
Playground.storyName = 'Text';
|
package/src/Theme/ThemeStory.jsx
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ColorItem, ColorPalette } from '@storybook/addon-docs';
|
|
3
|
-
|
|
4
|
-
const ThemeStory = () => {
|
|
5
|
-
return (
|
|
6
|
-
<ColorPalette>
|
|
7
|
-
<ColorItem
|
|
8
|
-
title="theme.color.brand"
|
|
9
|
-
subtitle="Brand Variants"
|
|
10
|
-
colors={{ brandLight: '#74AAFF', primary_default: '#2F80FF', brandDark: '#0B326F', brandDisabled: '#D8E7FF' }}
|
|
11
|
-
/>
|
|
12
|
-
<ColorItem
|
|
13
|
-
title="theme.color.text"
|
|
14
|
-
subtitle="Text Variants"
|
|
15
|
-
colors={{
|
|
16
|
-
on_surface_high: 'rgba(250, 252, 255, 0.9)',
|
|
17
|
-
on_surface_medium: 'rgba(215, 227, 245, 0.8)',
|
|
18
|
-
on_surface_low: 'rgba(164, 176, 193, 0.5)',
|
|
19
|
-
}}
|
|
20
|
-
/>
|
|
21
|
-
<ColorItem
|
|
22
|
-
title="theme.color.surface"
|
|
23
|
-
subtitle="Surface Variants"
|
|
24
|
-
colors={{
|
|
25
|
-
surface_dimmer: '#06080A',
|
|
26
|
-
surface_dim: '#080B0F',
|
|
27
|
-
surface_default: '#0B0F15',
|
|
28
|
-
surface_bright: '#12161C',
|
|
29
|
-
surface_brighter: '#1F2228',
|
|
30
|
-
}}
|
|
31
|
-
/>
|
|
32
|
-
<ColorItem
|
|
33
|
-
title="theme.color.primary"
|
|
34
|
-
subtitle="Primary Variants"
|
|
35
|
-
colors={{
|
|
36
|
-
primary_bright: '#6DA6FF',
|
|
37
|
-
primary_default: '#2F80FF',
|
|
38
|
-
primary_dim: '#184080',
|
|
39
|
-
primary_disabled: '#D8E7FF',
|
|
40
|
-
}}
|
|
41
|
-
/>
|
|
42
|
-
<ColorItem
|
|
43
|
-
title="theme.color.secondary"
|
|
44
|
-
subtitle="Secondary Variants"
|
|
45
|
-
colors={{
|
|
46
|
-
secondary_bright: '#505863',
|
|
47
|
-
secondary_default: '#657080',
|
|
48
|
-
secondary_dim: '#1E2329',
|
|
49
|
-
secondary_disabled: '#DCE4EF',
|
|
50
|
-
}}
|
|
51
|
-
/>
|
|
52
|
-
</ColorPalette>
|
|
53
|
-
);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export default ThemeStory;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Button } from '../Button';
|
|
4
|
-
import { Toast } from './Toast';
|
|
5
|
-
import mdx from './Toast.mdx';
|
|
6
|
-
|
|
7
|
-
const ReactToastStory = ({ ...props }) => {
|
|
8
|
-
return (
|
|
9
|
-
<Toast.Provider>
|
|
10
|
-
<ReactToastComponent {...props} />
|
|
11
|
-
</Toast.Provider>
|
|
12
|
-
);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const ToastMeta = {
|
|
16
|
-
title: 'UI Components/Toast',
|
|
17
|
-
component: ReactToastStory,
|
|
18
|
-
argTypes: {
|
|
19
|
-
onClick: { action: 'clicked' },
|
|
20
|
-
open: { control: 'boolean' },
|
|
21
|
-
variant: { control: 'select', options: ['error', 'standard', 'warning', 'success', ''] },
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
variant: 'standard',
|
|
25
|
-
title: 'Hello from Toast Component',
|
|
26
|
-
description: 'Hello from toast',
|
|
27
|
-
isClosable: true,
|
|
28
|
-
},
|
|
29
|
-
parameters: {
|
|
30
|
-
docs: {
|
|
31
|
-
page: mdx,
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const ReactToastComponent: ComponentStory<typeof ReactToastStory> = args => {
|
|
37
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
38
|
-
return (
|
|
39
|
-
<>
|
|
40
|
-
<Button onClick={() => setIsOpen(!isOpen)}>{isOpen ? 'Close' : 'Launch'} Toast</Button>
|
|
41
|
-
<Toast.HMSToast
|
|
42
|
-
title="This is a title"
|
|
43
|
-
description="This is a toast using the HMSToast component."
|
|
44
|
-
open={isOpen}
|
|
45
|
-
isClosable={true}
|
|
46
|
-
onOpenChange={o => setIsOpen(o)}
|
|
47
|
-
{...args}
|
|
48
|
-
/>
|
|
49
|
-
<Toast.Viewport css={{ bottom: '$24' }} />
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export const Playground: ComponentStory<typeof ReactToastStory> = ReactToastStory.bind({});
|
|
55
|
-
Playground.storyName = 'HMSToast';
|
|
56
|
-
export default ToastMeta;
|
package/src/Toast/Toast.mdx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Replacing DocsPage with custom `MDX` content
|
|
2
|
-
|
|
3
|
-
This file is a documentation-only `MDX`file to customize Storybook's [DocsPage](https://storybook.js.org/docs/react/writing-docs/docs-page#replacing-docspage).
|
|
4
|
-
|
|
5
|
-
It can be further expanded with your own code snippets and include specific information related to your stories.
|
|
6
|
-
|
|
7
|
-
For example:
|
|
8
|
-
|
|
9
|
-
import { Story } from '@storybook/addon-docs';
|
|
10
|
-
|
|
11
|
-
## Dialog
|
|
12
|
-
|
|
13
|
-
Dialog is an hover component used to have a focus-mode like UI for users.
|
|
14
|
-
|
|
15
|
-
- [Example](#example)
|
|
16
|
-
|
|
17
|
-
### Example
|
|
18
|
-
|
|
19
|
-
<Story id="dialog--example" />
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { ComponentStory } from '@storybook/react';
|
|
3
|
-
import { Button } from '../Button';
|
|
4
|
-
import { Flex } from '../Layout';
|
|
5
|
-
import { Text } from '../Text';
|
|
6
|
-
import { Toast } from './Toast';
|
|
7
|
-
import ToastDocs from './Toast.mdx';
|
|
8
|
-
|
|
9
|
-
const ToastStory = ({ ...props }) => {
|
|
10
|
-
return (
|
|
11
|
-
<Toast.Provider>
|
|
12
|
-
<ToastComponent {...props} />
|
|
13
|
-
</Toast.Provider>
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const ToastMeta = {
|
|
18
|
-
title: 'UI Components/Toast',
|
|
19
|
-
component: ToastStory,
|
|
20
|
-
argTypes: {
|
|
21
|
-
onClick: { action: 'clicked' },
|
|
22
|
-
icon: { control: 'boolean' },
|
|
23
|
-
},
|
|
24
|
-
parameters: {
|
|
25
|
-
docs: {
|
|
26
|
-
page: ToastDocs,
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const ToastComponent = ({ ...props }) => {
|
|
32
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
33
|
-
return (
|
|
34
|
-
<>
|
|
35
|
-
<Button onClick={() => setIsOpen(!isOpen)}>{isOpen ? 'Close' : 'Launch'} Toast</Button>
|
|
36
|
-
<Toast.Root open={isOpen} onOpenChange={o => setIsOpen(o)} {...props}>
|
|
37
|
-
<Toast.Title asChild>
|
|
38
|
-
<Flex align="center" css={{ gap: '$4', flex: '1 1 0', minWidth: 0 }}>
|
|
39
|
-
<Text variant="sub1" css={{ c: 'inherit', wordBreak: 'break-word' }}>
|
|
40
|
-
Hello from toast.
|
|
41
|
-
</Text>
|
|
42
|
-
<Toast.Close />
|
|
43
|
-
</Flex>
|
|
44
|
-
</Toast.Title>
|
|
45
|
-
<Toast.Description>
|
|
46
|
-
This is a custom toast component using primitives with controlled open and close state using React state.
|
|
47
|
-
</Toast.Description>
|
|
48
|
-
</Toast.Root>
|
|
49
|
-
<Toast.Viewport css={{ bottom: '$24' }} />
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
export const Example: ComponentStory<typeof ToastStory> = ToastStory.bind({});
|
|
54
|
-
|
|
55
|
-
Example.storyName = 'Toast';
|
|
56
|
-
|
|
57
|
-
export default ToastMeta;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ComponentMeta } from '@storybook/react';
|
|
3
|
-
import { Flex } from '../Layout';
|
|
4
|
-
import { Text } from '../Text';
|
|
5
|
-
import { alignTooltip, sideTooltip, Tooltip } from './Tooltip';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'UI Components/Tooltip',
|
|
9
|
-
argTypes: {
|
|
10
|
-
outlined: { control: 'boolean' },
|
|
11
|
-
side: { control: 'radio' },
|
|
12
|
-
align: { control: 'radio' },
|
|
13
|
-
},
|
|
14
|
-
args: {
|
|
15
|
-
outlined: false,
|
|
16
|
-
side: 'bottom',
|
|
17
|
-
align: 'center',
|
|
18
|
-
},
|
|
19
|
-
component: Tooltip,
|
|
20
|
-
} as ComponentMeta<typeof Tooltip>;
|
|
21
|
-
|
|
22
|
-
const TooltipStoryWithString = (
|
|
23
|
-
args: JSX.IntrinsicAttributes & {
|
|
24
|
-
title?: React.ReactNode;
|
|
25
|
-
outlined?: boolean | undefined;
|
|
26
|
-
side?: sideTooltip;
|
|
27
|
-
align?: alignTooltip;
|
|
28
|
-
} & { children?: React.ReactNode },
|
|
29
|
-
) => {
|
|
30
|
-
return (
|
|
31
|
-
<Flex justify="center" align="center" css={{ w: 800, h: 200 }}>
|
|
32
|
-
<Tooltip title="This is title" {...args}>
|
|
33
|
-
<Text>Hover to see Tooltip</Text>
|
|
34
|
-
</Tooltip>
|
|
35
|
-
</Flex>
|
|
36
|
-
);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const ExampleWithString = TooltipStoryWithString.bind({});
|
|
40
|
-
|
|
41
|
-
const ExampleTitle = () => {
|
|
42
|
-
return <h3 style={{ color: '$on_primary_high' }}>This is title</h3>;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const TooltipStorywithReactNode = (
|
|
46
|
-
args: JSX.IntrinsicAttributes & {
|
|
47
|
-
title?: React.ReactNode;
|
|
48
|
-
outlined?: boolean | undefined;
|
|
49
|
-
side?: sideTooltip;
|
|
50
|
-
align?: alignTooltip;
|
|
51
|
-
} & { children?: React.ReactNode },
|
|
52
|
-
) => {
|
|
53
|
-
return (
|
|
54
|
-
<Flex justify="center" align="center" css={{ w: 800, h: 200 }}>
|
|
55
|
-
<Tooltip title={<ExampleTitle />} {...args}>
|
|
56
|
-
<Text>Hover to see tooltip</Text>
|
|
57
|
-
</Tooltip>
|
|
58
|
-
</Flex>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const ExampleWithReactNode = TooltipStorywithReactNode.bind({});
|
package/src/Video/UseVideo.mdx
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
## useVideo
|
|
2
|
-
|
|
3
|
-
For each peer, we’ll render a `<video>` element and a `<div>` element with their name.
|
|
4
|
-
To render the video, we need to call attachVideo method of hmsActions, which accepts a trackId and a DOM element.
|
|
5
|
-
But we have abstracted this implementation inside useVideo hook for ease. This hook will return an object `videoRef` given a video `trackId`. The returned `videoRef` can be used to set on a video element meant to display the video. The hook will take care of attaching and detaching video, and will automatically detach when the video goes out of view to save on bandwidth.
|
|
6
|
-
|
|
7
|
-
import { Story } from '@storybook/addon-docs';
|
|
8
|
-
|
|
9
|
-
```jsx
|
|
10
|
-
import { useVideo } from ‘@100mslive/react-sdk’;
|
|
11
|
-
function Peer({ peer }) {
|
|
12
|
-
const { videoRef } = useVideo({
|
|
13
|
-
trackId: peer.videoTrack,
|
|
14
|
-
});
|
|
15
|
-
return <video ref={videoRef} autoPlay muted playsInline />;
|
|
16
|
-
}
|
|
17
|
-
export default Peer;
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
> Note that `height` and `width` CSS properties need to be set on the `<video>` element to render the peer's video.
|
|
21
|
-
|
|
22
|
-
<Story id="rendering-video-video-component--video-example" />
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useVideo } from '@100mslive/react-sdk';
|
|
3
|
-
import UseVideoDocs from './UseVideo.mdx';
|
|
4
|
-
import { StyledVideo } from './Video';
|
|
5
|
-
|
|
6
|
-
const VideoHook = () => {
|
|
7
|
-
const { videoRef } = useVideo({
|
|
8
|
-
trackId: '1',
|
|
9
|
-
});
|
|
10
|
-
return <StyledVideo ref={videoRef} autoPlay playsInline muted />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const VideoStories = {
|
|
14
|
-
title: 'Rendering Video/useVideo hook',
|
|
15
|
-
component: VideoHook,
|
|
16
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
page: UseVideoDocs,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default VideoStories;
|
|
25
|
-
|
|
26
|
-
export const UseVideoHook = VideoHook.bind({});
|
package/src/Video/Video.mdx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
## `<Video />` component
|
|
2
|
-
|
|
3
|
-
You can directly use `<Video />` all it needs is `trackId` to render the video. This is a headless component to style it you can pass only valid css styles and className.
|
|
4
|
-
|
|
5
|
-
```jsx
|
|
6
|
-
import { useVideo } from '@100mslive/react-sdk';
|
|
7
|
-
import { Video } from '../';
|
|
8
|
-
|
|
9
|
-
const VideoComponent = () => {
|
|
10
|
-
return <Video trackId="2" />;
|
|
11
|
-
};
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
## Styled Video component
|
|
15
|
-
|
|
16
|
-
We use Stitches as our styling solution which provides a `css` prop for overriding styles easily. It’s like the style attribute, but it supports tokens, media queries, nesting and token-aware values.
|
|
17
|
-
|
|
18
|
-
Here's an example:
|
|
19
|
-
|
|
20
|
-
```jsx
|
|
21
|
-
const StyledVideoComponent = () => {
|
|
22
|
-
return <Video css={{ width: 500, height: 300 }} trackId="2" />;
|
|
23
|
-
};
|
|
24
|
-
```
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Video } from './Video';
|
|
3
|
-
import VideoDocs from './Video.mdx';
|
|
4
|
-
|
|
5
|
-
const VideoComponent = () => {
|
|
6
|
-
return <Video trackId="2" />;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const StyledVideoComponent = () => {
|
|
10
|
-
return <Video css={{ width: 500, height: 300 }} trackId="2" />;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const VideoStories = {
|
|
14
|
-
title: 'Rendering Video/Video Component',
|
|
15
|
-
component: VideoComponent,
|
|
16
|
-
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
|
|
17
|
-
parameters: {
|
|
18
|
-
docs: {
|
|
19
|
-
page: VideoDocs,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default VideoStories;
|
|
25
|
-
|
|
26
|
-
export const VideoExample = VideoComponent.bind({});
|
|
27
|
-
export const StyledVideoExample = StyledVideoComponent.bind({});
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { ComponentStory } from '@storybook/react';
|
|
3
|
-
import { selectPeers, useHMSStore, useVideoList } from '@100mslive/react-sdk';
|
|
4
|
-
import { MicOffIcon } from '@100mslive/react-icons';
|
|
5
|
-
import { Video } from '../Video/Video';
|
|
6
|
-
import { StyledVideoTile } from '../VideoTile';
|
|
7
|
-
import { StyledVideoList } from './StyledVideoList';
|
|
8
|
-
import { getLeft } from './videoListUtils';
|
|
9
|
-
|
|
10
|
-
const VideoListMeta = {
|
|
11
|
-
title: 'Video/VideoList',
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default VideoListMeta;
|
|
15
|
-
|
|
16
|
-
const VideoTile: React.FC<{ width: number; height: number; trackId: string; name: string }> = ({
|
|
17
|
-
width,
|
|
18
|
-
height,
|
|
19
|
-
trackId,
|
|
20
|
-
name,
|
|
21
|
-
}) => {
|
|
22
|
-
return (
|
|
23
|
-
<StyledVideoTile.Root css={{ width, height }}>
|
|
24
|
-
<StyledVideoTile.Container>
|
|
25
|
-
<Video trackId={trackId} />
|
|
26
|
-
<StyledVideoTile.Info>{name}</StyledVideoTile.Info>
|
|
27
|
-
<StyledVideoTile.AudioIndicator>
|
|
28
|
-
<MicOffIcon />
|
|
29
|
-
</StyledVideoTile.AudioIndicator>
|
|
30
|
-
</StyledVideoTile.Container>
|
|
31
|
-
</StyledVideoTile.Root>
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
interface VideoListProps {
|
|
36
|
-
maxTileCount: number;
|
|
37
|
-
aspectRatio: {
|
|
38
|
-
width: number;
|
|
39
|
-
height: number;
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const VideoListStory: React.FC<VideoListProps> = ({ maxTileCount, aspectRatio }) => {
|
|
44
|
-
const peers = useHMSStore(selectPeers);
|
|
45
|
-
const [page] = useState(0);
|
|
46
|
-
const { ref, pagesWithTiles } = useVideoList({
|
|
47
|
-
peers,
|
|
48
|
-
offsetY: 50,
|
|
49
|
-
maxTileCount,
|
|
50
|
-
aspectRatio,
|
|
51
|
-
});
|
|
52
|
-
return (
|
|
53
|
-
<StyledVideoList.Root css={{ height: '100vh', width: '100%' }} ref={ref}>
|
|
54
|
-
<StyledVideoList.Container>
|
|
55
|
-
{pagesWithTiles && pagesWithTiles.length > 0
|
|
56
|
-
? pagesWithTiles.map((tiles, pageNo) => (
|
|
57
|
-
<StyledVideoList.View
|
|
58
|
-
css={{
|
|
59
|
-
left: getLeft(pageNo, page),
|
|
60
|
-
transition: 'left 0.3s ease-in-out',
|
|
61
|
-
}}
|
|
62
|
-
>
|
|
63
|
-
{tiles.map((tile, i) =>
|
|
64
|
-
tile.track?.source === 'screen' ? null : (
|
|
65
|
-
<VideoTile
|
|
66
|
-
key={tile.track?.id || tile.peer.id + i}
|
|
67
|
-
width={tile.width}
|
|
68
|
-
height={tile.height}
|
|
69
|
-
trackId={tile.track?.id || ''}
|
|
70
|
-
name={tile.peer.name}
|
|
71
|
-
/>
|
|
72
|
-
),
|
|
73
|
-
)}
|
|
74
|
-
</StyledVideoList.View>
|
|
75
|
-
))
|
|
76
|
-
: null}
|
|
77
|
-
</StyledVideoList.Container>
|
|
78
|
-
</StyledVideoList.Root>
|
|
79
|
-
);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const Template: ComponentStory<typeof VideoListStory> = args => <VideoListStory {...args} />;
|
|
83
|
-
|
|
84
|
-
export const Example = Template.bind({});
|
|
85
|
-
|
|
86
|
-
Example.args = {
|
|
87
|
-
maxTileCount: 2,
|
|
88
|
-
aspectRatio: {
|
|
89
|
-
width: 2,
|
|
90
|
-
height: 1,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
## VideoTile
|
|
2
|
-
|
|
3
|
-
import { Story } from '@storybook/addon-docs';
|
|
4
|
-
|
|
5
|
-
Building a `<VideoTile />` component is all about composing styled/unstyled component provided by `../`. We will create a basic videotile by composing `StyledVideoTile`.
|
|
6
|
-
|
|
7
|
-
```jsx
|
|
8
|
-
import { StyledVideoTile, Video } from '../';
|
|
9
|
-
|
|
10
|
-
const VideoTileStory = () => {
|
|
11
|
-
return (
|
|
12
|
-
// width,height of the tile
|
|
13
|
-
<StyledVideoTile.Root css={{ width: 500, height: 300 }}>
|
|
14
|
-
<StyledVideoTile.Container>
|
|
15
|
-
{/* trackId of the peer */}
|
|
16
|
-
<Video trackId="1" />
|
|
17
|
-
{/* Meta info */}
|
|
18
|
-
<StyledVideoTile.Info>Deepankar</StyledVideoTile.Info>
|
|
19
|
-
<StyledVideoTile.AudioIndicator>
|
|
20
|
-
<MicOffIcon />
|
|
21
|
-
</StyledVideoTile.AudioIndicator>
|
|
22
|
-
</StyledVideoTile.Container>
|
|
23
|
-
</StyledVideoTile.Root>
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
<Story id="video-videotile--example" />
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MicOffIcon } from '@100mslive/react-icons';
|
|
3
|
-
import { Video } from '../Video/Video';
|
|
4
|
-
import { StyledVideoTile } from './StyledVideoTile';
|
|
5
|
-
import VideoTileDocs from './VideoTile.mdx';
|
|
6
|
-
|
|
7
|
-
const VideoTileMeta = {
|
|
8
|
-
title: 'Video/VideoTile',
|
|
9
|
-
parameters: {
|
|
10
|
-
docs: {
|
|
11
|
-
page: VideoTileDocs,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default VideoTileMeta;
|
|
17
|
-
|
|
18
|
-
const VideoTileStory = () => {
|
|
19
|
-
return (
|
|
20
|
-
<StyledVideoTile.Root css={{ width: 500, height: 300 }}>
|
|
21
|
-
<StyledVideoTile.Container>
|
|
22
|
-
<Video trackId="1" />
|
|
23
|
-
<StyledVideoTile.Info>Deepankar</StyledVideoTile.Info>
|
|
24
|
-
<StyledVideoTile.AudioIndicator>
|
|
25
|
-
<MicOffIcon />
|
|
26
|
-
</StyledVideoTile.AudioIndicator>
|
|
27
|
-
</StyledVideoTile.Container>
|
|
28
|
-
</StyledVideoTile.Root>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const Example = VideoTileStory.bind({});
|