Skip to content

Commit

Permalink
[shared-ux] Create Services, migrate Exit Full Screen button
Browse files Browse the repository at this point in the history
  • Loading branch information
clintandrewhall committed Jan 9, 2022
1 parent 83621d6 commit 4d6cd93
Show file tree
Hide file tree
Showing 30 changed files with 1,085 additions and 5 deletions.
20 changes: 20 additions & 0 deletions src/plugins/shared_ux/.storybook/decorators.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import React from 'react';
import { DecoratorFn } from '@storybook/react';
import { ServicesProvider } from '../public/services';
import { servicesFactory } from '../public/services/storybook';

/**
* A Storybook decorator that provides the Shared UX `ServicesProvider` with Storybook-specific
* implementations to stories.
*/
export const servicesDecorator: DecoratorFn = (storyFn) => (
<ServicesProvider {...servicesFactory({})}>{storyFn()}</ServicesProvider>
);
12 changes: 12 additions & 0 deletions src/plugins/shared_ux/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { addDecorator } from '@storybook/react';
import { servicesDecorator } from './decorators';

addDecorator(servicesDecorator);
19 changes: 19 additions & 0 deletions src/plugins/shared_ux/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

module.exports = {
preset: '@kbn/test',
rootDir: '../../..',
roots: ['<rootDir>/src/plugins/shared_ux'],
transform: {
'^.+\\.stories\\.tsx?$': '@storybook/addon-storyshots/injectFileName',
},
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/src/plugins/shared_ux',
coverageReporters: ['text', 'html'],
collectCoverageFrom: ['<rootDir>/src/plugins/shared_ux/{common,public,server}/**/*.{js,ts,tsx}'],
};

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4d6cd93

Please sign in to comment.