2018-09-27 05:15:41 -05:00
|
|
|
import React, { SFC } from 'react';
|
2018-09-25 07:53:55 -05:00
|
|
|
import classNames from 'classnames/bind';
|
|
|
|
import PluginListItem from './PluginListItem';
|
2018-09-27 07:45:36 -05:00
|
|
|
import { Plugin } from 'app/types';
|
2018-09-27 05:15:41 -05:00
|
|
|
import { LayoutMode, LayoutModes } from '../../core/components/LayoutSelector/LayoutSelector';
|
|
|
|
|
|
|
|
interface Props {
|
2018-09-27 07:51:00 -05:00
|
|
|
plugins: Plugin[];
|
2018-09-27 05:15:41 -05:00
|
|
|
layoutMode: LayoutMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
const PluginList: SFC<Props> = props => {
|
|
|
|
const { plugins, layoutMode } = props;
|
2018-09-25 07:53:55 -05:00
|
|
|
|
|
|
|
const listStyle = classNames({
|
|
|
|
'card-section': true,
|
2018-09-27 05:15:41 -05:00
|
|
|
'card-list-layout-grid': layoutMode === LayoutModes.Grid,
|
|
|
|
'card-list-layout-list': layoutMode === LayoutModes.List,
|
2018-09-25 07:53:55 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section className={listStyle}>
|
|
|
|
<ol className="card-list">
|
|
|
|
{plugins.map((plugin, index) => {
|
|
|
|
return <PluginListItem plugin={plugin} key={`${plugin.name}-${index}`} />;
|
|
|
|
})}
|
|
|
|
</ol>
|
|
|
|
</section>
|
|
|
|
);
|
2018-09-27 05:15:41 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
export default PluginList;
|