Skip to content

Commit a26c7ea

Browse files
committed
feat(WebexMeetingControls): add layout styling
1 parent 64067f5 commit a26c7ea

File tree

4 files changed

+55
-6
lines changed

4 files changed

+55
-6
lines changed
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3+
import classNames from 'classnames';
4+
5+
import {WEBEX_COMPONENTS_CLASS_PREFIX} from '../../constants';
6+
7+
import './WebexMeetingControls.scss';
38

49
export const MeetingContext = React.createContext();
510

@@ -10,15 +15,25 @@ export const MeetingContext = React.createContext();
1015
* @param {object} props
1116
* @returns {object} JSX of the component
1217
*/
13-
export default function WebexMeetingControls({meetingID, children}) {
18+
export default function WebexMeetingControls({children, className, meetingID}) {
19+
const mainClasses = {
20+
[`${WEBEX_COMPONENTS_CLASS_PREFIX}-meeting-controls`]: true,
21+
[className]: !!className,
22+
};
23+
1424
return (
1525
<MeetingContext.Provider value={meetingID}>
16-
<div className="meeting-controls">{children}</div>
26+
<div className={classNames(mainClasses)}>{children}</div>
1727
</MeetingContext.Provider>
1828
);
1929
}
2030

2131
WebexMeetingControls.propTypes = {
22-
meetingID: PropTypes.string.isRequired,
2332
children: PropTypes.node.isRequired,
33+
className: PropTypes.string,
34+
meetingID: PropTypes.string.isRequired,
35+
};
36+
37+
WebexMeetingControls.defaultProps = {
38+
className: '',
2439
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@import '../../styles/variables';
2+
3+
.#{$WEBEX_COMPONENTS_CLASS_PREFIX}-meeting-controls {
4+
display: flex;
5+
justify-content: center;
6+
align-items: center;
7+
8+
> * {
9+
margin: 0.3125rem;
10+
}
11+
}

src/components/WebexMeetingControl/WebexMeetingControls.test.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@ import WebexMeetingControls from './WebexMeetingControls';
44

55
describe('Webex Meeting Controls component', () => {
66
test('matches snapshot', () => {
7-
const meetingID = 'my-meeting';
87
const component = shallow(
9-
<WebexMeetingControls meetingID={meetingID}>
8+
<WebexMeetingControls meetingID="my-meeting">
9+
<div className="test" />
10+
</WebexMeetingControls>
11+
);
12+
13+
expect(component).toMatchSnapshot();
14+
});
15+
16+
test('matches snapshot with custom CSS class', () => {
17+
const component = shallow(
18+
<WebexMeetingControls className="my-custom-class" meetingID="my-meeting">
1019
<div className="test" />
1120
</WebexMeetingControls>
1221
);

src/components/WebexMeetingControl/__snapshots__/WebexMeetingControls.test.js.snap

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,21 @@ exports[`Webex Meeting Controls component matches snapshot 1`] = `
55
value="my-meeting"
66
>
77
<div
8-
className="meeting-controls"
8+
className="wxc-meeting-controls"
9+
>
10+
<div
11+
className="test"
12+
/>
13+
</div>
14+
</ContextProvider>
15+
`;
16+
17+
exports[`Webex Meeting Controls component matches snapshot with custom CSS class 1`] = `
18+
<ContextProvider
19+
value="my-meeting"
20+
>
21+
<div
22+
className="wxc-meeting-controls my-custom-class"
923
>
1024
<div
1125
className="test"

0 commit comments

Comments
 (0)