Skip to content

Commit

Permalink
Added storybook.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuznietsov committed Jun 11, 2021
1 parent cbbf981 commit 010b7b9
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/dev/storybook/aliases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const storybookAliases = {
dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/.storybook',
data_enhanced: 'x-pack/plugins/data_enhanced/.storybook',
embeddable: 'src/plugins/embeddable/.storybook',
expression_reveal_image: 'src/plugins/expression_reveal_image/.storybook',
infra: 'x-pack/plugins/infra/.storybook',
security_solution: 'x-pack/plugins/security_solution/.storybook',
ui_actions_enhanced: 'x-pack/plugins/ui_actions_enhanced/.storybook',
Expand Down
10 changes: 10 additions & 0 deletions src/plugins/expression_reveal_image/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* 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.
*/

// eslint-disable-next-line import/no-commonjs
module.exports = require('@kbn/storybook').defaultConfig;
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* 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.
*/

export * from './render';

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.revealImage {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;

.revealImageAligner {
background-size: contain;
background-repeat: no-repeat;
}

// disables selection and dragging
.revealImage__image {
user-select: none;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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 { storiesOf } from '@storybook/react';
import { revealImageRenderer } from '../';
import { Render } from '../../__stories__';
import { elasticOutline } from '../../../common/lib/elastic_outline';
import { elasticLogo } from '../../../common/lib/elastic_logo';
import { Origin } from '../../expression_functions';
import './reveal_image.scss';

storiesOf('renderers/revealImage', module).add('default', () => {
const config = {
image: elasticLogo,
emptyImage: elasticOutline,
origin: Origin.LEFT,
percent: 0.45,
};

return <Render renderer={revealImageRenderer} config={config} />;
});

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.revealImage {
height: 100%;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;

.revealImageAligner {
background-size: contain;
background-repeat: no-repeat;
}

// disables selection and dragging
.revealImage__image {
user-select: none;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { revealImage } from '../';
import { Render } from './render';
import { Render } from '../../__stories__';
import { elasticOutline } from '../../../common/lib/elastic_outline';
import { elasticOutline } from '../../../common/lib/elastic_logo';
import { elasticLogo } from '../../../common/lib/elastic_logo';
import { Origin } from '../../expression_functions';
import './reveal_image.scss';

storiesOf('renderers/revealImage_legacy', module).add('default', () => {
const config = {
Expand Down

0 comments on commit 010b7b9

Please sign in to comment.