This commit is contained in:
eric-burel 2019-02-15 17:11:11 +01:00
parent 73fcdaab4e
commit 39e54621d8
5 changed files with 39 additions and 47 deletions

View file

@ -2,10 +2,8 @@ import React from 'react';
import { runCallbacks } from 'meteor/vulcan:lib';
export default (C) => {
const stories = runCallbacks({ name: 'stories.register', iterator: [], /* properties: {} */});
const WithStories = (props) => (
<C {...props} stories={stories} />
);
return WithStories;
};
export default C => {
const stories = runCallbacks({ name: 'stories.register', iterator: [] /* properties: {} */ });
const WithStories = props => <C {...props} stories={stories} />;
return WithStories;
};

View file

@ -1,4 +1,4 @@
import {addRoute, getDynamicComponent} from 'meteor/vulcan:lib';
import { addRoute, getDynamicComponent } from 'meteor/vulcan:lib';
addRoute([
// {name: 'cheatsheet', path: '/cheatsheet', component: import('./components/Cheatsheet.jsx')},
@ -49,7 +49,7 @@ addRoute([
name: 'debugVulcanBook',
path: '/debug/vulcanbook',
componentName: 'VulcanBook',
layoutName: 'DebugLayout'
layoutName: 'DebugLayout',
},
{
name: 'debugI18n',

View file

@ -1,10 +1,10 @@
import { registerCallback } from 'meteor/vulcan:lib';
registerCallback({
name: 'stories.register',
description: 'Add stories to VulcanBook',
iterator: {stories: 'Currently defined stories'},
name: 'stories.register',
description: 'Add stories to VulcanBook',
iterator: { stories: 'Currently defined stories' },
// properties: [{}],
runs: 'sync',
runs: 'sync',
returns: 'stories',
});
});

View file

@ -4,39 +4,33 @@ import { Components, addCallback } from 'meteor/vulcan:lib';
import Callbacks from '../callbacks/collection';
const defaultProps = {
Datatable: {
}
Datatable: {},
};
const coreStories = [
{
group: 'core/DataTable',
name: 'Datatable with static data',
render: () => (
<Components.Datatable
{...defaultProps.Datatable}
data={[{ 'col1': 'value1.1', 'col2': 42 }, { 'col1': 'value1.2', 'col2': 43 }]}
/>)
},
{
group: 'core/DataTable',
name: 'Datatable with dynamic data',
render: () => (
<Components.Datatable
collection={Callbacks}
options={{
fragmentName: 'CallbacksFragment',
limit: 3
}}
columns={[
'name',
'iterator',
'properties',
'description',
'hooks',
]}
/>
)
},
{
group: 'core/DataTable',
name: 'Datatable with static data',
render: () => (
<Components.Datatable
{...defaultProps.Datatable}
data={[{ col1: 'value1.1', col2: 42 }, { col1: 'value1.2', col2: 43 }]}
/>
),
},
{
group: 'core/DataTable',
name: 'Datatable with dynamic data',
render: () => (
<Components.Datatable
collection={Callbacks}
options={{
fragmentName: 'CallbacksFragment',
limit: 3,
}}
columns={['name', 'iterator', 'properties', 'description', 'hooks']}
/>
),
},
];
addCallback('stories.register', (stories = []) => [...stories, ...coreStories]);
addCallback('stories.register', (stories = []) => [...stories, ...coreStories]);

View file

@ -1,2 +1,2 @@
import './callbacks';
import './core';
import './core';