From 793ebead6ad57b63a163f8783ab1807e047ff4cc Mon Sep 17 00:00:00 2001 From: Demetriad Sinzeanu <demetriad.sinzeanu@thinslices.com> Date: Tue, 6 Nov 2018 10:49:40 +0200 Subject: [PATCH] docs(faradai-ui): update tag items docs --- packages/component-faraday-ui/src/Tag.js | 23 +++++++++++++++++++---- packages/component-faraday-ui/src/Text.js | 18 +++++++++--------- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/packages/component-faraday-ui/src/Tag.js b/packages/component-faraday-ui/src/Tag.js index fd6ce0316..3c6997d15 100644 --- a/packages/component-faraday-ui/src/Tag.js +++ b/packages/component-faraday-ui/src/Tag.js @@ -1,11 +1,12 @@ -import { has } from 'lodash' +import { get } from 'lodash' +import PropTypes from 'prop-types' import { th } from '@pubsweet/ui-toolkit' import styled, { css } from 'styled-components' import { marginHelper } from './styledHelpers' const tagCSS = props => { - if (has(props, 'oldStatus')) { + if (get(props, 'oldStatus')) { return css` background-color: ${th('colorFurnitureHue')}; height: calc(${th('gridUnit')} * 3) @@ -15,7 +16,7 @@ const tagCSS = props => { ` } - if (has(props, `status`)) { + if (get(props, `status`)) { return css` background-color: ${th('tag.statusBackgroundColor')}; padding: calc(${th('gridUnit')} / 4) ${th('gridUnit')}; @@ -35,7 +36,7 @@ const tagCSS = props => { } /** @component */ -export default styled.div` +const Tag = styled.div` border-radius: ${th('tag.borderRadius') ? th('tag.borderRadius') : th('borderRadius')}; @@ -52,3 +53,17 @@ export default styled.div` ${tagCSS}; ${marginHelper}; ` + +Tag.propTypes = { + /** if true then object gets properties. */ + oldStatus: PropTypes.bool, + /** if true then object gets properties. */ + status: PropTypes.boo, +} + +Tag.defaultProps = { + oldStatus: false, + status: false, +} + +export default Tag diff --git a/packages/component-faraday-ui/src/Text.js b/packages/component-faraday-ui/src/Text.js index 0368f97a3..06d321cd4 100644 --- a/packages/component-faraday-ui/src/Text.js +++ b/packages/component-faraday-ui/src/Text.js @@ -100,23 +100,23 @@ const Text = ({ bullet, children, ...rest }) => ) Text.propTypes = { - /** if true */ + /** if true then object gets properties. */ secondary: PropTypes.bool, - /** if true then object gets properties */ + /** if true then object gets properties. */ error: PropTypes.bool, - /** if true then object gets properties */ + /** if true then object gets properties. */ customId: PropTypes.bool, - /** if true then object gets properties */ + /** if true then object gets properties. */ labelLine: PropTypes.bool, - /** if true then object gets properties */ + /** if true then object gets properties. */ journal: PropTypes.bool, - /** if true thenobject gets properties */ + /** if true thenobject gets properties. */ small: PropTypes.bool, - /** defines how items will be displayed */ + /** defines how items will be displayed. */ display: PropTypes.string, - /** defines how items will be aligned */ + /** defines how items will be aligned. */ align: PropTypes.string, - /** defines if there will be a white space */ + /** defines if there will be a white space. */ whiteSpace: PropTypes.string, } -- GitLab