HomePage in progress

This commit is contained in:
Ky 2019-03-06 17:03:30 +01:00
parent 916ebff9d4
commit b31017ee77
2 changed files with 47 additions and 3 deletions

View File

@ -5,7 +5,7 @@
*/
import React from 'react';
// import PropTypes from 'prop-types';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { bindActionCreators, compose } from 'redux';
@ -15,16 +15,55 @@ import makeSelectHomePage from './selectors';
import reducer from './reducer';
import saga from './saga';
// Design
import PluginHeader from 'components/PluginHeader';
import EmptyContentTypeView from '../../components/EmptyContentTypeView';
import TableList from '../../components/TableList';
import styles from './styles.scss';
export class HomePage extends React.Component { // eslint-disable-line react/prefer-stateless-function
render() {
const { models } = this.props;
const availableNumber = models.length;
const title = availableNumber > 1 ? `${pluginId}.table.contentType.title.plural`
: `${pluginId}.table.contentType.title.singular`;
const renderViewContent = availableNumber === 0 ?
<EmptyContentTypeView handleButtonClick={() => {}} />
: (
<TableList
availableNumber={availableNumber}
title={title}
buttonLabel={`${pluginId}.button.contentType.add`}
onButtonClick={() => {}}
onHandleDelete={() => {}}
rowItems={this.props.models}
/>
);
return (
<div>
<div className={styles.homePage}>
<PluginHeader
title={{
id: `${pluginId}.home.contentTypeBuilder.name`,
}}
description={{
id: `${pluginId}.home.contentTypeBuilder.description`,
values: {
label: 'description', // TODO - replace w/ something better
},
}}
actions={[]}
/>
{renderViewContent}
</div>
);
}
}
HomePage.propTypes = {};
HomePage.propTypes = {
models: PropTypes.array.isRequired,
};
const mapStateToProps = createStructuredSelector({
homepage: makeSelectHomePage(),

View File

@ -0,0 +1,5 @@
.homePage { /* stylelint-disable */
padding: 2.4rem 3rem;
background: rgba(14,22,34,0.02);
min-height: calc(100vh - 6rem); // TODO shoukd be variable
}