Skip to content

Commit

Permalink
Add a custom styled ControlBar example to e2e samples (#1288)
Browse files Browse the repository at this point in the history
* Add boilerplate for custom styled component example

* Add custom styled component buttons for e2e testing

* Update js bundle automation snapshots

Co-authored-by: edwardlee-msft <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 11, 2022
1 parent 69e789e commit bc9764e
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
2 changes: 2 additions & 0 deletions samples/ComponentExamples/src/Examples.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { CallAgentProvider } from '@azure/communication-react';
import { CallProvider } from '@azure/communication-react';
import { RenderVideoTileExample } from './examples/RenderSingleVideoTileExample';
import { initializeIcons, registerIcons } from '@fluentui/react';
import { StyledControlBarExample } from './examples/StyledControlBarExample';

initializeIcons();
registerIcons({ icons: { ...DEFAULT_COMPOSITE_ICONS } });
Expand Down Expand Up @@ -81,6 +82,7 @@ export const Examples = (): JSX.Element => {
<CallAgentProvider callAgent={callAgent}>
<CallProvider call={callInstance}>
<RenderVideoTileExample />
<StyledControlBarExample />
</CallProvider>
</CallAgentProvider>
</CallClientProvider>
Expand Down
41 changes: 41 additions & 0 deletions samples/ComponentExamples/src/examples/StyledControlBarExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import {
CameraButton,
ControlBar,
ControlBarButtonStyles,
DevicesButton,
EndCallButton,
MicrophoneButton,
ScreenShareButton,
usePropsFor
} from '@azure/communication-react';
import React from 'react';

export const StyledControlBarExample = (): JSX.Element => {
const cameraButtonProps = usePropsFor(CameraButton);
const microphoneButtonProps = usePropsFor(MicrophoneButton);
const screenShareButtonProps = usePropsFor(ScreenShareButton);
const deviceButtonProps = usePropsFor(DevicesButton);
const endCallButtonProps = usePropsFor(EndCallButton);

const controlBarButtonStyle: ControlBarButtonStyles = {
root: {
background: '#ffff00'
}
};

return (
<>
<h3>An example of custom sytled Call ControlBar:</h3>
<br />
<ControlBar layout={'horizontal'}>
<CameraButton styles={controlBarButtonStyle} {...cameraButtonProps} />
<MicrophoneButton styles={controlBarButtonStyle} {...microphoneButtonProps} />
<ScreenShareButton styles={controlBarButtonStyle} {...screenShareButtonProps} />
<DevicesButton styles={controlBarButtonStyle} {...deviceButtonProps} />
<EndCallButton styles={controlBarButtonStyle} {...endCallButtonProps} />
</ControlBar>
</>
);
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bc9764e

Please sign in to comment.