Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[drift] Update Drift Storybook to apply context
  • Loading branch information
clintandrewhall committed Aug 25, 2022
commit 50eed6b7f71b3b15583c8e91a4654199348b4b55
36 changes: 31 additions & 5 deletions x-pack/plugins/cloud/public/components/chat/chat.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@ import {
EuiFlexGroup,
EuiFlexItem,
} from '@elastic/eui';

import { forceReRender } from '@storybook/react';

import { Chat } from './chat';
import { ServicesProvider } from '../../services';

export default {
title: 'Chat Widget',
description: '',
parameters: {},
description:
'A Chat widget, enabled in Cloud, that allows a person to talk to Elastic about their deployment',
};

const Toaster = () => {
Expand Down Expand Up @@ -53,11 +55,28 @@ const Toaster = () => {
);
};

export const Component = () => {
interface Params {
id: string;
email: string;
chatURL: string;
jwt: string;
}

export const Component = ({ id, email, chatURL, jwt }: Params) => {
const [isHidden, setIsHidden] = useState(false);

return (
<>
<ServicesProvider
chat={{
enabled: true,
chatURL,
user: {
jwt,
id,
email,
},
}}
>
<EuiFlexGroup gutterSize="s">
<EuiFlexItem grow={false}>
<Toaster />
Expand All @@ -75,6 +94,13 @@ export const Component = () => {
</EuiFlexItem>
</EuiFlexGroup>
<Chat onHide={() => setIsHidden(true)} />
</>
</ServicesProvider>
);
};

Component.args = {
id: '1234567890',
email: 'email.address@elasticsearch.com',
chatURL: 'https://elasticcloud-production-chat-us-east-1.s3.amazonaws.com/drift-iframe.html',
jwt: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiaWF0IjoxNTE2MjM5MDIyfQ.L8i6g3PfcHlioHCCPURC9pmXT7gdJpx3kOoyAfNUwCc',
Comment thread
clintandrewhall marked this conversation as resolved.
Outdated
};