Sha256: 8d6947ab16b426de8dc32b49c60a6a0f95f2fd3665c21512eeb27c8dcd4aa4f9

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

import React from 'react';
import { storiesOf } from '@storybook/react';
import { withKnobs, object, select } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';

import {
  TASKS_DASHBOARD_AVAILABLE_TIMES,
  TASKS_DASHBOARD_AVAILABLE_QUERY_STATES,
  TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS,
  TASKS_DASHBOARD_AVAILABLE_QUERY_MODES,
} from '../../TasksDashboardConstants';
import { MOCKED_DATA } from './TasksCardsGrid.fixtures';
import TasksCardsGrid from './TasksCardsGrid';

const createSelect = (name, options) =>
  select(name, { ...options, NONE: 'none' }, 'none');

storiesOf('TasksDashboard/TasksCardsGrid', module)
  .addDecorator(withKnobs)
  .add('TasksCardsGrid', () => {
    const selectTime = select(
      'time',
      TASKS_DASHBOARD_AVAILABLE_TIMES,
      TasksCardsGrid.defaultProps.time
    );
    const selectState = createSelect(
      'query.state',
      TASKS_DASHBOARD_AVAILABLE_QUERY_STATES
    );
    const selectResult = createSelect(
      'query.result',
      TASKS_DASHBOARD_AVAILABLE_QUERY_RESULTS
    );
    const selectMode = createSelect(
      'query.mode',
      TASKS_DASHBOARD_AVAILABLE_QUERY_MODES
    );

    return (
      <TasksCardsGrid
        time={selectTime}
        query={{
          state: selectState,
          result: selectResult,
          mode: selectMode,
          time: selectTime,
        }}
        data={object('data', MOCKED_DATA)}
        updateQuery={action('updateQuery')}
      />
    );
  });

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
foreman-tasks-0.15.6 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js
foreman-tasks-0.15.5 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js
foreman-tasks-0.15.4 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js
foreman-tasks-0.15.3 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js
foreman-tasks-0.15.2 webpack/ForemanTasks/Components/TasksDashboard/Components/TasksCardsGrid/TasksCardsGrid.stories.js