Skip to content

Commit

Permalink
feat(WebexInMeeting): implement one
Browse files Browse the repository at this point in the history
  • Loading branch information
akoushke committed Jan 22, 2020
1 parent 15b9064 commit cc5e17e
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/components/WebexInMeeting/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Webex In-Meeting Component

Webex In-Meeting component displays the [Webex Local Media](../WebexLocalMedia) component on top of the [Webex Remote Media](../WebexRemoteMedia) component for the in meeting media experience.

<p align="center">
<img src="./WebexInMeeting.png" alt="Default Webex InMeeting" />
</p>

## Preview

To see all the different possible states of the Webex Interstitial Meeting component, you can run our Storybook:

```shell
npm start
```

## Embed

1. Create a component adapter from which the data will be retrieved (See [adapters](../../adapters)). For instance:

```js
const jsonAdapter = new WebexJSONAdapter(jsonData);
```

2. Create a component instance by passing the meeting ID as a string and
enclose it within [a data provider](../WebexDataProvider/WebexDataProvider.js)
that takes the [component data adapter](../../adapters/WebexJSONAdapter.js) that we created previously

```js
<WebexDataProvider adapter={jsonAdapter}>
<WebexInMeeting meetingID="meetingID" />
</WebexDataProvider>
```

The component knows how to manage its data. If anything changes in the data source that the adapter manages, the component will also update on its own.
20 changes: 20 additions & 0 deletions src/components/WebexInMeeting/WebexInMeeting.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.in-meeting {
position: relative;
width: 100%;
height: 100%;
}

.in-meeting .remote-media {
position: relative;
width: 100%;
height: 100%;
}

.in-meeting .local-media {
position: absolute;
bottom: 25%;
right: 3%;
width: 20%;
height: 20%;
z-index: 1;
}
26 changes: 26 additions & 0 deletions src/components/WebexInMeeting/WebexInMeeting.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import PropTypes from 'prop-types';

import {WebexLocalMedia, WebexRemoteMedia} from '..';

import './WebexInMeeting.css';

/**
* Webex In-Meeting component displays the remote stream plus
* the local stream at the bottom right corner.
*
* @param {object} props
* @returns {object} JSX of the component
*/
export default function WebexInMeeting({meetingID}) {
return (
<div className="in-meeting">
<WebexRemoteMedia meetingID={meetingID} />
<WebexLocalMedia meetingID={meetingID} />
</div>
);
}

WebexInMeeting.propTypes = {
meetingID: PropTypes.string.isRequired,
};
Binary file added src/components/WebexInMeeting/WebexInMeeting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions src/components/WebexInMeeting/WebexInMeeting.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from 'react';
import {storiesOf} from '@storybook/react';

import jsonData from '../../data';
import {WebexJSONAdapter} from '../../adapters';

import {WebexInMeeting, WebexDataProvider} from '..';

// Setup for the stories
const stories = storiesOf('Webex InMeeting', module);
const webexAdapter = new WebexJSONAdapter(jsonData);
const wrapperStyle = {height: '500px', width: '800px', border: '1px solid black'};

stories.add('remote and local media enabled', () => (
<div style={wrapperStyle}>
<WebexDataProvider adapter={webexAdapter}>
<WebexInMeeting meetingID="remote&localMedia" />
</WebexDataProvider>
</div>
));

stories.add('only remote media enabled', () => (
<div style={wrapperStyle}>
<WebexDataProvider adapter={webexAdapter}>
<WebexInMeeting meetingID="remoteMedia" />
</WebexDataProvider>
</div>
));
13 changes: 13 additions & 0 deletions src/components/WebexInMeeting/WebexInMeeting.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';

import WebexInMeeting from '../WebexInMeeting/WebexInMeeting';

jest.mock('../hooks/useMeeting');

describe('Webex InMeeting component', () => {
describe('snapshot', () => {
test('matches snapshot of meeting', () => {
expect(shallow(<WebexInMeeting meetingID="remoteMedia" />)).toMatchSnapshot();
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Webex InMeeting component snapshot matches snapshot of meeting 1`] = `
<div
className="in-meeting"
>
<WebexRemoteMedia
meetingID="remoteMedia"
/>
<WebexLocalMedia
meetingID="remoteMedia"
/>
</div>
`;
1 change: 1 addition & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export {default as WebexAvatar} from './WebexAvatar/WebexAvatar';
export {default as WebexActivity} from './WebexActivity/WebexActivity';
export {default as WebexActivityStream} from './WebexActivityStream/WebexActivityStream';
export {default as WebexDataProvider, AdapterContext} from './WebexDataProvider/WebexDataProvider';
export {default as WebexInMeeting} from './WebexInMeeting/WebexInMeeting';
export {default as WebexInterstitialMeeting} from './WebexInterstitialMeeting/WebexInterstitialMeeting';
export {default as WebexLocalMedia} from './WebexLocalMedia/WebexLocalMedia';
export {default as WebexMeetingControl} from './WebexMeetingControl/WebexMeetingControl';
Expand Down

0 comments on commit cc5e17e

Please sign in to comment.