From 055ff076bb97aae2d2f85b6ef946fe33ca8e443d Mon Sep 17 00:00:00 2001 From: Alexandru Munteanu <alexandru.munt@gmail.com> Date: Tue, 6 Nov 2018 17:10:01 +0200 Subject: [PATCH] docs(faraday-ui): fix some props that anca wrote --- packages/component-faraday-ui/src/AuthorTag.js | 6 +++--- .../component-faraday-ui/src/AutosaveIndicator.js | 6 ++---- packages/component-faraday-ui/src/ContextualBox.js | 11 +++++------ 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/packages/component-faraday-ui/src/AuthorTag.js b/packages/component-faraday-ui/src/AuthorTag.js index 00168896f..4ec4cf6a3 100644 --- a/packages/component-faraday-ui/src/AuthorTag.js +++ b/packages/component-faraday-ui/src/AuthorTag.js @@ -26,9 +26,9 @@ const AuthorTag = ({ AuthorTag.propTypes = { /** The author you want to be on the card. */ author: PropTypes.shape({ - id: PropTypes.number, - firstName: PropTypes.number, - lastName: PropTypes.number, + id: PropTypes.string, + firstName: PropTypes.string, + lastName: PropTypes.string, isCorresponding: PropTypes.bool, isSubmitting: PropTypes.bool, affiliationNumber: PropTypes.number, diff --git a/packages/component-faraday-ui/src/AutosaveIndicator.js b/packages/component-faraday-ui/src/AutosaveIndicator.js index 2fa2048bd..1a3b309ff 100644 --- a/packages/component-faraday-ui/src/AutosaveIndicator.js +++ b/packages/component-faraday-ui/src/AutosaveIndicator.js @@ -102,13 +102,11 @@ export default compose( AutosaveIndicator.propTypes = { /** Make appear loader until save. */ - autosave: PropTypes.objectOf( - PropTypes.oneOfType([PropTypes.bool, PropTypes.date, PropTypes.string]), - ), + autosave: PropTypes.object, // eslint-disable-line } AutosaveIndicator.defaultProps = { - autosave: undefined, + autosave: {}, } // #region styles const Root = styled.div` diff --git a/packages/component-faraday-ui/src/ContextualBox.js b/packages/component-faraday-ui/src/ContextualBox.js index 40e3e6f5f..f2c0d0d9b 100644 --- a/packages/component-faraday-ui/src/ContextualBox.js +++ b/packages/component-faraday-ui/src/ContextualBox.js @@ -1,6 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' -import { has } from 'lodash' +import { isUndefined } from 'lodash' import styled from 'styled-components' import { Icon, H3 } from '@pubsweet/ui' import { override, th } from '@pubsweet/ui-toolkit' @@ -35,7 +35,7 @@ const CustomHeader = ({ ) const ContextualBox = ({ label, children, rightChildren, ...props }) => - has(props, 'expanded') ? ( + !isUndefined(props.expanded) ? ( <ControlledAccordion header={CustomHeader} label={label} @@ -61,7 +61,7 @@ ContextualBox.propTypes = { /** Label of the contextual box. */ label: PropTypes.string, /** Component or html to be rendered on the right side. */ - rightChildren: PropTypes.oneOfType([PropTypes.element, PropTypes.func]), + rightChildren: PropTypes.any, // eslint-disable-line /** The state of the contextual box. If passed from a parent then the component * is controlled and can be expanded/collapsed remotely. */ @@ -69,13 +69,12 @@ ContextualBox.propTypes = { /** Callback function used to control the state of the component. * To be used together with the `expanded` prop. */ - toggle: PropTypes.func, + toggle: PropTypes.func, // eslint-disable-line } ContextualBox.defaultProps = { label: '', - rightChildren: undefined, - toggle: null, + // rightChildren: undefined, } // #region styles -- GitLab