import { ResourcesState } from '~/store/resources/resources';
import { Location } from 'history';
-export type ElementListReducer = (startingList: React.ReactElement[]) => React.ReactElement[];
+export type ElementListReducer = (startingList: React.ReactElement[], itemClass?: string) => React.ReactElement[];
export type CategoriesListReducer = (startingList: string[]) => string[];
export type NavigateMatcher = (dispatch: Dispatch, getState: () => RootState, uuid: string) => boolean;
export type LocationChangeMatcher = (store: RootStore, pathname: string) => boolean;
// Starting here, import and register your Workbench 2 plugins. //
-import { register as blankUIPluginRegister } from '~/plugins/blank/index';
+// import { register as blankUIPluginRegister } from '~/plugins/blank/index';
import { register as examplePluginRegister, routePath as exampleRoutePath } from '~/plugins/example/index';
import { register as rootRedirectRegister } from '~/plugins/root-redirect/index';
-blankUIPluginRegister(pluginConfig);
+// blankUIPluginRegister(pluginConfig);
examplePluginRegister(pluginConfig);
rootRedirectRegister(pluginConfig, exampleRoutePath);
import { Dispatch } from 'redux';
import { RootState } from '~/store/store';
import { push } from "react-router-redux";
-import { Typography } from "@material-ui/core";
+import { Card, CardContent, Typography } from "@material-ui/core";
import { Route, matchPath } from "react-router";
import { RootStore } from '~/store/store';
import { activateSidePanelTreeItem } from '~/store/side-panel-tree/side-panel-tree-actions';
interface ExampleProps {
pressedCount: number;
+ className?: string;
}
const exampleMapStateToProps = (state: RootState) => ({ pressedCount: state.properties[propertyKey] || 0 });
};
const ExampleMenuComponent = connect(exampleMapStateToProps)(
- ({ pressedCount, dispatch }: ExampleProps & DispatchProp<any>) =>
- <MenuItem onClick={() => incrementPressedCount(dispatch, pressedCount)}>Example menu item</MenuItem >
+ ({ pressedCount, dispatch, className }: ExampleProps & DispatchProp<any>) =>
+ <MenuItem className={className} onClick={() => incrementPressedCount(dispatch, pressedCount)}>Example menu item</MenuItem >
);
const ExamplePluginMainPanel = connect(exampleMapStateToProps)(
({ pressedCount }: ExampleProps) =>
- <Typography>
- This is a example main panel plugin. The example menu item has been pressed {pressedCount} times.
- </Typography>);
+ <Card>
+ <CardContent>
+ <Typography>
+ This is a example main panel plugin. The example menu item has been pressed {pressedCount} times.
+ </Typography>
+ </CardContent>
+ </Card>);
export const register = (pluginConfig: PluginConfig) => {
return elms;
});
- pluginConfig.accountMenuList.push((elms) => {
- elms.push(<ExampleMenuComponent />);
+ pluginConfig.accountMenuList.push((elms, menuItemClass) => {
+ elms.push(<ExampleMenuComponent className={menuItemClass} />);
return elms;
});
- pluginConfig.newButtonMenuList.push((elms) => {
- elms.push(<ExampleMenuComponent />);
+ pluginConfig.newButtonMenuList.push((elms, menuItemClass) => {
+ elms.push(<ExampleMenuComponent className={menuItemClass} />);
return elms;
});
</MenuItem>
</>;
- const reduceItemsFn: (a: React.ReactElement[],
- b: ElementListReducer) => React.ReactElement[] = (a, b) => b(a);
+ const reduceItemsFn: (a: React.ReactElement[], b: ElementListReducer) => React.ReactElement[] =
+ (a, b) => b(a, classes.menuItem);
menuItems = React.createElement(React.Fragment, null,
pluginConfig.newButtonMenuList.reduce(reduceItemsFn, React.Children.toArray(menuItems.props.children)));