Skip to content

Commit

Permalink
Fixed a bunch more duplicate field class names (#2865)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz authored Apr 30, 2020
1 parent 9edaa19 commit 60e2c7e
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 15 deletions.
7 changes: 7 additions & 0 deletions .changeset/spicy-apples-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@keystonejs/demo-custom-fields': patch
'@keystonejs/fields': patch
'@keystonejs/fields-mongoid': patch
---

Fixed a bunch more duplicate field class names (no functional changes).
4 changes: 2 additions & 2 deletions demo-projects/custom-fields/fields/MultiCheck/views/Field.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ShieldIcon } from '@arch-ui/icons';
import { Lozenge } from '@arch-ui/lozenge';
import { colors, gridSize } from '@arch-ui/theme';

const TextField = ({ onChange, autoFocus, field, value, errors }) => {
const MultiCheckField = ({ onChange, autoFocus, field, value, errors }) => {
const initialState = value ? value : field.config.defaultValue;
const [values, setValues] = useState(initialState);
useEffect(() => {
Expand Down Expand Up @@ -58,4 +58,4 @@ const TextField = ({ onChange, autoFocus, field, value, errors }) => {
);
};

export default TextField;
export default MultiCheckField;
2 changes: 1 addition & 1 deletion packages/fields-mongoid/src/views/Controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FieldController from '@keystonejs/fields/Controller';

export default class TextController extends FieldController {
export default class MongoIdController extends FieldController {
getFilterGraphQL = ({ type, value }) => {
switch (type) {
case 'is': {
Expand Down
4 changes: 2 additions & 2 deletions packages/fields-mongoid/src/views/Filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Input } from '@arch-ui/input';

const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
const MongoIdFilterView = ({ onChange, filter, field, innerRef, value }) => {
const handleChange = ({ target: { value } }) => {
onChange(value);
};
Expand All @@ -13,4 +13,4 @@ const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
return <Input onChange={handleChange} ref={innerRef} placeholder={placeholder} value={value} />;
};

export default TextFilterView;
export default MongoIdFilterView;
2 changes: 1 addition & 1 deletion packages/fields/src/types/Decimal/views/Controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FieldController from '../../../Controller';

export default class TextController extends FieldController {
export default class DecimalController extends FieldController {
getFilterGraphQL = ({ type, value }) => {
const key = type === 'is' ? `${this.path}` : `${this.path}_${type}`;
return `${key}: "${value}"`;
Expand Down
4 changes: 2 additions & 2 deletions packages/fields/src/types/Decimal/views/Filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Input } from '@arch-ui/input';

const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
const DecimalFilterView = ({ onChange, filter, field, innerRef, value }) => {
const valueToString = value => {
// Make the value a string to prevent loss of accuracy and precision.
if (typeof value === 'string') {
Expand Down Expand Up @@ -31,4 +31,4 @@ const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
);
};

export default TextFilterView;
export default DecimalFilterView;
4 changes: 2 additions & 2 deletions packages/fields/src/types/File/views/Filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Input } from '@arch-ui/input';

const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
const FileFilterView = ({ onChange, filter, field, innerRef, value }) => {
const handleChange = event => {
const value = event.target.value;
onChange(value.replace(/\D/g, ''));
Expand All @@ -14,4 +14,4 @@ const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
return <Input onChange={handleChange} ref={innerRef} placeholder={placeholder} value={value} />;
};

export default TextFilterView;
export default FileFilterView;
2 changes: 1 addition & 1 deletion packages/fields/src/types/Float/views/Controller.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import FieldController from '../../../Controller';

export default class TextController extends FieldController {
export default class FloatController extends FieldController {
getFilterGraphQL = ({ type, value }) => {
const key = type === 'is' ? `${this.path}` : `${this.path}_${type}`;
return `${key}: ${value}`;
Expand Down
4 changes: 2 additions & 2 deletions packages/fields/src/types/Float/views/Filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Input } from '@arch-ui/input';

const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
const FloatFilterView = ({ onChange, filter, field, innerRef, value }) => {
const handleChange = event => {
const value = event.target.value;
if (/^-?\d*\.?\d*$/.test(value)) {
Expand All @@ -16,4 +16,4 @@ const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
return <Input onChange={handleChange} ref={innerRef} placeholder={placeholder} value={value} />;
};

export default TextFilterView;
export default FloatFilterView;
4 changes: 2 additions & 2 deletions packages/fields/src/types/Integer/views/Filter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Input } from '@arch-ui/input';

const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
const IntegerFilterView = ({ onChange, filter, field, innerRef, value }) => {
const handleChange = event => {
const value = event.target.value;
onChange(value.replace(/[^\d,\s]/g, ''));
Expand All @@ -13,4 +13,4 @@ const TextFilterView = ({ onChange, filter, field, innerRef, value }) => {
return <Input onChange={handleChange} ref={innerRef} placeholder={placeholder} value={value} />;
};

export default TextFilterView;
export default IntegerFilterView;

0 comments on commit 60e2c7e

Please sign in to comment.