chore: prop types

This commit is contained in:
cha0s 2020-06-21 01:04:57 -05:00
parent 0c8ec0b1d2
commit 61dac8ddfb
11 changed files with 22 additions and 23 deletions

View File

@ -3,7 +3,7 @@ import contempo from 'contempo';
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
import Value from './value.type-renderer';
const decorate = compose(
@ -33,7 +33,7 @@ const Actions = ({
);
Actions.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.shape({}).isRequired,
};

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
const Bool = ({
value,
@ -13,7 +13,7 @@ const Bool = ({
);
Bool.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.bool.isRequired,
};

View File

@ -3,7 +3,7 @@ import contempo from 'contempo';
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
import Value from './value.type-renderer';
const renderOperand = (context, operand) => (
@ -61,7 +61,7 @@ const Condition = ({
);
Condition.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.shape({}).isRequired,
};

View File

@ -4,7 +4,7 @@ import React from 'react';
import useTypeRenderers from '~/client/hooks/useTypeRenderers';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
import {contextStepsList} from './steps-lists';
import {typeFromLiteral} from './typing';
@ -18,6 +18,7 @@ const Literal = ({
}) => {
const typeRenderers = useTypeRenderers();
const type = typeFromLiteral(value.value);
const Component = typeRenderers[type];
const stepsList = contextStepsList(context, type);
const tierOptions = Object.keys(stepsList.reduce((r, optionSteps) => {
if (!optionSteps[0] || !optionSteps[0].key) {
@ -25,7 +26,6 @@ const Literal = ({
}
return {...r, [optionSteps[0].key]: true};
}, {}));
tierOptions.splice(tierOptions.indexOf('context'), 1);
tierOptions.push('<literal>');
return (
<div className="literal">
@ -38,7 +38,6 @@ const Literal = ({
</select>
{
(() => {
const Component = typeRenderers[type];
return Component
? <Component value={value.value} />
: null;
@ -49,7 +48,7 @@ const Literal = ({
};
Literal.propTypes = {
...propertyPropTypes,
...propTypes,
};
export default {

View File

@ -3,7 +3,7 @@ import contempo from 'contempo';
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
const decorate = compose(
contempo(require('./number.raw.scss')),
@ -42,7 +42,7 @@ const Number = ({
);
Number.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.number.isRequired,
};

View File

@ -3,7 +3,7 @@ import contempo from 'contempo';
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
const decorate = compose(
contempo(require('./object.raw.scss')),
@ -31,7 +31,7 @@ const ObjectRenderer = ({
};
ObjectRenderer.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.bool.isRequired,
};

View File

@ -3,7 +3,7 @@ import contempo from 'contempo';
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
import Actions from './actions.type-renderer';
const decorate = compose(
@ -38,7 +38,7 @@ const Routines = ({
};
Routines.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.shape({}).isRequired,
};

View File

@ -1,7 +1,7 @@
import PropTypes from 'prop-types';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
const String = ({
options,
@ -23,7 +23,7 @@ const String = ({
);
String.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.string.isRequired,
};

View File

@ -2,7 +2,7 @@ import {compose} from '@avocado/core';
import contempo from 'contempo';
import React from 'react';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
import {contextStepsList} from './steps-lists';
import {typeFromSteps} from './typing';
import Value from './value.type-renderer';
@ -87,10 +87,10 @@ const Traversal = (props) => {
};
Traversal.propTypes = {
...propertyPropTypes,
...propTypes,
};
export default {
type: 'traversal',
type: '-traversal',
Component: decorate(Traversal),
};

View File

@ -6,7 +6,7 @@ import React from 'react';
import useTypeRenderers from '~/client/hooks/useTypeRenderers';
import {typeFromLiteral, typeFromValue} from '~/client/components/types/typing';
import propertyPropTypes from './property-prop-types';
import propTypes from './prop-types';
const decorate = compose(
contempo(require('./value.raw.scss')),
@ -33,7 +33,7 @@ const Value = ({
};
Value.propTypes = {
...propertyPropTypes,
...propTypes,
value: PropTypes.shape({}).isRequired,
};