standardizes custom component naming to proper nouns

This commit is contained in:
James
2020-09-30 08:53:15 -04:00
parent d9e62e9a6d
commit b3dda3c070
13 changed files with 41 additions and 23 deletions

View File

@@ -131,8 +131,8 @@ const Nav = () => {
const {
admin: {
components: {
nav: CustomNav,
} = {}
Nav: CustomNav,
} = {},
} = {},
} = useConfig();
@@ -142,6 +142,6 @@ const Nav = () => {
DefaultComponent={DefaultNav}
/>
);
}
};
export default Nav;

View File

@@ -80,7 +80,7 @@ const Condition = (props) => {
</div>
<div className={`${baseClass}__value`}>
<RenderCustomComponent
CustomComponent={activeField?.props?.admin?.components?.filter}
CustomComponent={activeField?.props?.admin?.components?.Filter}
DefaultComponent={ValueComponent}
componentProps={{
...activeField.props,

View File

@@ -87,7 +87,7 @@ const RenderFields = (props) => {
return (
<RenderCustomComponent
key={i}
CustomComponent={field?.admin?.components?.field}
CustomComponent={field?.admin?.components?.Field}
DefaultComponent={FieldComponent}
componentProps={{
...field,

View File

@@ -25,7 +25,7 @@ const Icon = () => {
admin: {
components: {
graphics: {
icon: CustomIcon,
Icon: CustomIcon,
} = {},
} = {},
} = {},

View File

@@ -55,7 +55,7 @@ const Logo = () => {
admin: {
components: {
graphics: {
logo: CustomLogo,
Logo: CustomLogo,
} = {},
} = {},
} = {},

View File

@@ -20,7 +20,7 @@ const AccountView = () => {
collections,
admin: {
components: {
account: CustomAccount,
Account: CustomAccount,
} = {},
} = {},
} = useConfig();

View File

@@ -15,7 +15,7 @@ const Dashboard = () => {
globals,
admin: {
components: {
dashboard: CustomDashboard,
Dashboard: CustomDashboard,
} = {},
} = {},
} = useConfig();

View File

@@ -36,7 +36,7 @@ const GlobalView = (props) => {
admin: {
components: {
views: {
edit: CustomEdit,
Edit: CustomEdit,
} = {},
} = {},
} = {},
@@ -100,6 +100,11 @@ GlobalView.propTypes = {
label: PropTypes.string.isRequired,
slug: PropTypes.string.isRequired,
fields: PropTypes.arrayOf(PropTypes.shape({})),
admin: PropTypes.shape({
components: PropTypes.shape({
Edit: PropTypes.node,
}),
}),
}).isRequired,
};

View File

@@ -22,7 +22,7 @@ const EditView = (props) => {
useAsTitle,
components: {
views: {
edit: CustomEdit,
Edit: CustomEdit,
} = {},
} = {},
},
@@ -71,7 +71,7 @@ const EditView = (props) => {
}
setStepNav(nav);
}, [setStepNav, isEditing, pluralLabel, dataToRender, slug, useAsTitle]);
}, [setStepNav, isEditing, pluralLabel, dataToRender, slug, useAsTitle, admin]);
useEffect(() => {
const awaitInitialState = async () => {
@@ -129,6 +129,9 @@ EditView.propTypes = {
slug: PropTypes.string,
admin: PropTypes.shape({
useAsTitle: PropTypes.string,
components: PropTypes.shape({
Edit: PropTypes.node,
}),
}),
fields: PropTypes.arrayOf(PropTypes.shape({})),
preview: PropTypes.func,

View File

@@ -61,7 +61,7 @@ const Cell = (props) => {
field: {
admin: {
components: {
cell: CustomCell,
Cell: CustomCell,
} = {},
} = {},
},
@@ -110,7 +110,7 @@ const propTypes = {
type: PropTypes.string,
admin: PropTypes.shape({
components: PropTypes.shape({
cell: PropTypes.func,
Cell: PropTypes.func,
}),
}),
}).isRequired,

View File

@@ -19,6 +19,11 @@ const ListView = (props) => {
labels: {
plural,
},
admin: {
components: {
List: CustomList,
} = {},
},
},
} = props;
@@ -70,7 +75,7 @@ const ListView = (props) => {
return (
<RenderCustomComponent
DefaultComponent={DefaultList}
path={`${slug}.views.List`}
CustomComponent={CustomList}
componentProps={{
collection: { ...collection, fields },
newDocumentURL,
@@ -91,6 +96,11 @@ ListView.propTypes = {
singular: PropTypes.string,
plural: PropTypes.string,
}),
admin: PropTypes.shape({
components: PropTypes.shape({
List: PropTypes.node,
}),
}),
slug: PropTypes.string,
fields: PropTypes.arrayOf(PropTypes.shape),
timestamps: PropTypes.bool,