mirror of
https://github.com/vector-im/element-call.git
synced 2022-05-22 02:31:18 +03:00
Update VideoGrid story
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import React, { useState } from "react";
|
||||
import VideoGrid from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoGrid";
|
||||
import VideoGrid, {
|
||||
useVideoGridLayout,
|
||||
} from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoGrid";
|
||||
import VideoTile from "matrix-react-sdk/src/components/views/voip/GroupCallView/VideoTile";
|
||||
import "matrix-react-sdk/res/css/views/voip/GroupCallView/_VideoGrid.scss";
|
||||
import { useMemo } from "react";
|
||||
import { Button } from "../button";
|
||||
|
||||
export default {
|
||||
title: "VideoGrid",
|
||||
parameters: {
|
||||
layout: "fullscreen",
|
||||
},
|
||||
argTypes: {
|
||||
layout: {
|
||||
options: ["freedom", "spotlight"],
|
||||
control: { type: "radio" },
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const ParticipantsTest = ({ layout, participantCount }) => {
|
||||
export const ParticipantsTest = () => {
|
||||
const [layout, setLayout] = useVideoGridLayout();
|
||||
const [participantCount, setParticipantCount] = useState(1);
|
||||
|
||||
const items = useMemo(
|
||||
() =>
|
||||
new Array(participantCount).fill(undefined).map((_, i) => ({
|
||||
@@ -29,13 +29,42 @@ export const ParticipantsTest = ({ layout, participantCount }) => {
|
||||
);
|
||||
|
||||
return (
|
||||
<div style={{ display: "flex", width: "100vw", height: "100vh" }}>
|
||||
<VideoGrid layout={layout} items={items}>
|
||||
{({ item, ...rest }) => (
|
||||
<VideoTile key={item.id} name={`User ${item.id}`} {...rest} />
|
||||
<>
|
||||
<div style={{ display: "flex", width: "100vw", height: "32px" }}>
|
||||
<Button
|
||||
onPress={() =>
|
||||
setLayout((layout) =>
|
||||
layout === "freedom" ? "spotlight" : "freedom"
|
||||
)
|
||||
}
|
||||
>
|
||||
Toggle Layout
|
||||
</Button>
|
||||
{participantCount < 12 && (
|
||||
<Button onPress={() => setParticipantCount((count) => count + 1)}>
|
||||
Add Participant
|
||||
</Button>
|
||||
)}
|
||||
</VideoGrid>
|
||||
</div>
|
||||
{participantCount > 0 && (
|
||||
<Button onPress={() => setParticipantCount((count) => count - 1)}>
|
||||
Remove Participant
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "100vw",
|
||||
height: "calc(100vh - 32px)",
|
||||
}}
|
||||
>
|
||||
<VideoGrid layout={layout} items={items}>
|
||||
{({ item, ...rest }) => (
|
||||
<VideoTile key={item.id} name={`User ${item.id}`} {...rest} />
|
||||
)}
|
||||
</VideoGrid>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user