From 31a54e2c09f164952d13bbc85749845fdc65fed1 Mon Sep 17 00:00:00 2001 From: James Date: Fri, 7 Dec 2018 15:19:18 -0800 Subject: [PATCH] streamlines top level collection components, rebuilds StickyAction component --- demo/Page/components/Archive/index.js | 14 +++----- demo/Page/components/Edit/index.js | 30 +++++++--------- demo/client/components/Routes.js | 9 +++-- src/components.js | 1 + src/components/controls/Button/index.scss | 4 +-- src/components/data/archive.js | 4 +-- src/components/data/edit.js | 4 +-- src/components/field-types/Input/index.scss | 27 +------------- .../field-types/Textarea/index.scss | 27 +------------- src/components/field-types/fieldType/index.js | 8 +++-- .../field-types/fieldType/index.scss | 31 ++++++++++++++++ src/components/layout/Sticky/index.js | 2 +- src/components/layout/Sticky/index.scss | 14 -------- src/components/modules/APIUrl/index.js | 6 ++-- src/components/modules/APIUrl/index.scss | 6 ++++ .../modules/SearchableTable/index.js | 4 +-- src/components/modules/StickyAction/index.js | 19 ++++++++++ .../modules/StickyAction/index.scss | 36 +++++++++++++++++++ src/components/routes/Collections.js | 11 ++++-- .../views/collections/Edit/index.scss | 17 --------- src/scss/vars.scss | 4 +-- 21 files changed, 143 insertions(+), 135 deletions(-) create mode 100644 src/components/field-types/fieldType/index.scss create mode 100644 src/components/modules/APIUrl/index.scss create mode 100644 src/components/modules/StickyAction/index.js create mode 100644 src/components/modules/StickyAction/index.scss diff --git a/demo/Page/components/Archive/index.js b/demo/Page/components/Archive/index.js index f6e3b68701..d32f1f4dc2 100644 --- a/demo/Page/components/Archive/index.js +++ b/demo/Page/components/Archive/index.js @@ -6,23 +6,17 @@ import { SearchableTable, } from 'payload/components'; -import Page from '../../Page.config'; -import config from '../../../payload.config.json'; - -const collection = Page; - const Archive = props => { - return ( - + - + ); } -export default withArchiveData(Archive, collection, config); +export default withArchiveData(Archive); diff --git a/demo/Page/components/Edit/index.js b/demo/Page/components/Edit/index.js index 99a89399c9..77e12f9eac 100644 --- a/demo/Page/components/Edit/index.js +++ b/demo/Page/components/Edit/index.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import { withEditData, EditView, - Sticky, + StickyAction, APIUrl, Button, Form, @@ -13,28 +13,22 @@ import { } from 'payload/components'; import { toKebabCase } from 'payload/utils'; -import Page from '../../Page.config'; -import config from '../../../payload.config.json'; - class Edit extends Component { constructor(props) { super(props); - this.collection = Page; const uid = this.props.match.params.slug; this.state = { uid: uid, slug: uid, - action: `${config.serverUrl}/${this.collection.slug}${uid ? `/${uid}` : ''}`, + action: `${this.props.config.serverUrl}/${this.props.collection.slug}${uid ? `/${uid}` : ''}`, method: uid ? 'put' : 'post' } - - this.updateSlug = this.updateSlug.bind(this); } - updateSlug(e) { + updateSlug = e => { this.setState({ slug: toKebabCase(e.target.value) }); } @@ -43,16 +37,18 @@ class Edit extends Component { const initialData = this.props.data ? this.props.data : {}; return ( - +
- - -
+ + } action={ + Save -
-
+ + } /> +