From 2e3d5ab333e822f716689da09edfc5ef31fff592 Mon Sep 17 00:00:00 2001 From: adriancarranza Date: Wed, 31 Jan 2024 11:20:54 -0700 Subject: [PATCH 1/7] switching intern drivers --- src/components/NextLink/NextLink.jsx | 2 +- src/compounds/Item/CardBody.jsx | 107 +++++++++++++++------------ src/compounds/Item/Item.jsx | 13 +++- 3 files changed, 72 insertions(+), 50 deletions(-) diff --git a/src/components/NextLink/NextLink.jsx b/src/components/NextLink/NextLink.jsx index fd165ad2..cd1b22fe 100644 --- a/src/components/NextLink/NextLink.jsx +++ b/src/components/NextLink/NextLink.jsx @@ -19,7 +19,7 @@ const NextLinkWrapper = React.forwardRef(({ addClass, text, href }, ref) => ( )) NextLink.propTypes = { - text: PropTypes.string.isRequired, + // text: PropTypes.string.isRequired, addClass: PropTypes.string, path: PropTypes.exact({ pathname: PropTypes.string.isRequired, diff --git a/src/compounds/Item/CardBody.jsx b/src/compounds/Item/CardBody.jsx index 2c44d048..9f70941a 100644 --- a/src/compounds/Item/CardBody.jsx +++ b/src/compounds/Item/CardBody.jsx @@ -1,55 +1,70 @@ -import React from 'react' -import PropTypes from 'prop-types' -import { Card } from 'react-bootstrap' -import NextLink from '../../components/NextLink/NextLink' -import LinkedButton from '../LinkedButton/LinkedButton' +import React from "react"; +import PropTypes from "prop-types"; +import { Card } from "react-bootstrap"; +import NextLink from "../../components/NextLink/NextLink"; +import LinkedButton from "../LinkedButton/LinkedButton"; -const CardBody = ({ buttonLink, buttonProps, item, - orientation, titleLink, withButtonLink, withTitleLink }) => { - const { id, description, name } = item +const CardBody = ({ + buttonLink, + buttonProps, + item, + orientation, + titleLink, + withButtonLink, + withTitleLink, +}) => { + const { id, description, name } = item; return ( - -
-
- + +
+
+ {(withTitleLink) && ( - - )} - {(!withTitleLink) && ( - name + )} + {(!withTitleLink) && ( + name )} - {description && ( - - {description} - + {description && ( + {description} + )} +
+ {withButtonLink && ( +
+ +
)}
- {(withButtonLink) && ( -
- -
- )} -
- - ) -} + + ); +}; CardBody.propTypes = { buttonLink: PropTypes.string, // currently overriding the label on a button from being required in this component, // because it shouldn't be if we are not rendering a button // refer to the comment below - buttonProps: PropTypes.shape({ ...LinkedButton.propTypes.buttonProps, label: PropTypes.string }), + buttonProps: PropTypes.shape({ + ...LinkedButton.propTypes.buttonProps, + label: PropTypes.string, + }), // TODO(alishaevn): is there a way to set conditional proptypes without adding another package? // buttonProps: props => props.withButtonLink // ? PropTypes.shape(Button.propTypes) @@ -64,22 +79,22 @@ CardBody.propTypes = { name: PropTypes.string.isRequired, slug: PropTypes.string, }), - orientation: PropTypes.oneOf(['horizontal', 'vertical']), + orientation: PropTypes.oneOf(["horizontal", "vertical"]), titleLink: PropTypes.string, withButtonLink: PropTypes.bool, withTitleLink: PropTypes.bool, -} +}; CardBody.defaultProps = { - buttonLink: '', + buttonLink: "", buttonProps: LinkedButton.defaultProps, item: { - description: '', + description: "", }, - orientation: 'vertical', - titleLink: '', + orientation: "vertical", + titleLink: "", withButtonLink: false, withTitleLink: false, -} +}; -export default CardBody +export default CardBody; diff --git a/src/compounds/Item/Item.jsx b/src/compounds/Item/Item.jsx index f10f10a3..e65a1c85 100644 --- a/src/compounds/Item/Item.jsx +++ b/src/compounds/Item/Item.jsx @@ -5,6 +5,7 @@ import Image from '../../components/Image/Image' import CardBody from './CardBody' import LinkedButton from '../LinkedButton/LinkedButton' import ItemLoading from './ItemLoading' +import NextLink from '../../components/NextLink/NextLink' import './item.scss' const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, titleLink, withButtonLink, @@ -52,8 +53,10 @@ const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, tit
) : ( - <> - + {alt} - + + )} + path={{ pathname: item.href, query: { id }}} + addClass="text-decoration-none link-hover" + /> )} ) From 0ca3a262046aeaeff60c5a786829134af4ab2df7 Mon Sep 17 00:00:00 2001 From: LEARN Academy Date: Wed, 31 Jan 2024 16:37:58 -0800 Subject: [PATCH 2/7] Make boxes clickable dquote> dquote> -removed clickable link dquote> -wrapped card in clickable link to new request dquote> Co-authored-by: Dalton McAuliffe dquote> Co-authored-by: Adrian Carranza Ref:https://github.com/scientist-softserv/webstore-component-library/issues/200 --- src/compounds/Item/Item.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compounds/Item/Item.jsx b/src/compounds/Item/Item.jsx index e65a1c85..8a879da6 100644 --- a/src/compounds/Item/Item.jsx +++ b/src/compounds/Item/Item.jsx @@ -56,7 +56,7 @@ const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, tit - {alt} )} From 05f53b6f5dab5b0b5b6348df26113d79a1f471f4 Mon Sep 17 00:00:00 2001 From: LEARN Academy Date: Thu, 1 Feb 2024 09:28:45 -0800 Subject: [PATCH 3/7] minor changes --- src/compounds/Item/CardBody.jsx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/compounds/Item/CardBody.jsx b/src/compounds/Item/CardBody.jsx index 9f70941a..c711f41c 100644 --- a/src/compounds/Item/CardBody.jsx +++ b/src/compounds/Item/CardBody.jsx @@ -1,8 +1,8 @@ -import React from "react"; -import PropTypes from "prop-types"; -import { Card } from "react-bootstrap"; -import NextLink from "../../components/NextLink/NextLink"; -import LinkedButton from "../LinkedButton/LinkedButton"; +import React from 'react' +import PropTypes from 'prop-types' +import { Card } from 'react-bootstrap' +import NextLink from '../../components/NextLink/NextLink' +import LinkedButton from '../LinkedButton/LinkedButton' const CardBody = ({ buttonLink, @@ -27,11 +27,11 @@ const CardBody = ({
{(withTitleLink) && ( - )} + )} {(!withTitleLink) && ( name )} @@ -79,20 +79,20 @@ CardBody.propTypes = { name: PropTypes.string.isRequired, slug: PropTypes.string, }), - orientation: PropTypes.oneOf(["horizontal", "vertical"]), + orientation: PropTypes.oneOf(['horizontal', 'vertical']), titleLink: PropTypes.string, withButtonLink: PropTypes.bool, withTitleLink: PropTypes.bool, }; CardBody.defaultProps = { - buttonLink: "", + buttonLink: '', buttonProps: LinkedButton.defaultProps, item: { - description: "", + description: '', }, - orientation: "vertical", - titleLink: "", + orientation: 'vertical', + titleLink: '', withButtonLink: false, withTitleLink: false, }; From 566cbfcab09014f2e85e5465b1b1decb829b564c Mon Sep 17 00:00:00 2001 From: Summer Cook Date: Thu, 1 Feb 2024 09:39:07 -0800 Subject: [PATCH 4/7] revert cardbody --- src/compounds/Item/CardBody.jsx | 85 ++++++++++++++------------------- 1 file changed, 35 insertions(+), 50 deletions(-) diff --git a/src/compounds/Item/CardBody.jsx b/src/compounds/Item/CardBody.jsx index c711f41c..564255eb 100644 --- a/src/compounds/Item/CardBody.jsx +++ b/src/compounds/Item/CardBody.jsx @@ -4,67 +4,52 @@ import { Card } from 'react-bootstrap' import NextLink from '../../components/NextLink/NextLink' import LinkedButton from '../LinkedButton/LinkedButton' -const CardBody = ({ - buttonLink, - buttonProps, - item, - orientation, - titleLink, - withButtonLink, - withTitleLink, -}) => { - const { id, description, name } = item; +const CardBody = ({ buttonLink, buttonProps, item, + orientation, titleLink, withButtonLink, withTitleLink }) => { + const { id, description, name } = item return ( - -
-
- + +
+
+ {(withTitleLink) && ( )} - {(!withTitleLink) && ( - name + text={name} + path={{ pathname: titleLink, query: { id } }} + addClass='text-decoration-none link-hover' + /> )} - - {description && ( - {description} + {(!withTitleLink) && ( + name )} -
- {withButtonLink && ( -
- -
+ + {description && ( + + {description} + )}
-
- ); -}; + {(withButtonLink) && ( +
+ +
+ )} +
+ + ) +} CardBody.propTypes = { buttonLink: PropTypes.string, // currently overriding the label on a button from being required in this component, // because it shouldn't be if we are not rendering a button // refer to the comment below - buttonProps: PropTypes.shape({ - ...LinkedButton.propTypes.buttonProps, - label: PropTypes.string, - }), + buttonProps: PropTypes.shape({ ...LinkedButton.propTypes.buttonProps, label: PropTypes.string }), // TODO(alishaevn): is there a way to set conditional proptypes without adding another package? // buttonProps: props => props.withButtonLink // ? PropTypes.shape(Button.propTypes) @@ -83,7 +68,7 @@ CardBody.propTypes = { titleLink: PropTypes.string, withButtonLink: PropTypes.bool, withTitleLink: PropTypes.bool, -}; +} CardBody.defaultProps = { buttonLink: '', @@ -95,6 +80,6 @@ CardBody.defaultProps = { titleLink: '', withButtonLink: false, withTitleLink: false, -}; +} -export default CardBody; +export default CardBody \ No newline at end of file From c396bcf88b3732bda3b3809f887955620791f672 Mon Sep 17 00:00:00 2001 From: Summer Cook Date: Thu, 1 Feb 2024 09:39:55 -0800 Subject: [PATCH 5/7] add newline to cardbody --- src/compounds/Item/CardBody.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compounds/Item/CardBody.jsx b/src/compounds/Item/CardBody.jsx index 564255eb..2c44d048 100644 --- a/src/compounds/Item/CardBody.jsx +++ b/src/compounds/Item/CardBody.jsx @@ -82,4 +82,4 @@ CardBody.defaultProps = { withTitleLink: false, } -export default CardBody \ No newline at end of file +export default CardBody From e7df29e1453fa665525e40e7436fc2951883c124 Mon Sep 17 00:00:00 2001 From: LEARN Academy Date: Thu, 1 Feb 2024 10:01:21 -0800 Subject: [PATCH 6/7] update prop type from text to children --- src/components/NextLink/NextLink.jsx | 13 ++++--- src/components/NextLink/NextLink.stories.jsx | 2 +- src/compounds/Item/CardBody.jsx | 2 +- src/compounds/Item/Item.jsx | 40 ++++++++++---------- 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/components/NextLink/NextLink.jsx b/src/components/NextLink/NextLink.jsx index cd1b22fe..c0c3598f 100644 --- a/src/components/NextLink/NextLink.jsx +++ b/src/components/NextLink/NextLink.jsx @@ -2,24 +2,27 @@ import React from 'react' import Link from 'next/link' import PropTypes from 'prop-types' -const NextLink = ({ addClass, text, path }) => ( +const NextLink = ({ addClass, children, path }) => ( ) -const NextLinkWrapper = React.forwardRef(({ addClass, text, href }, ref) => ( +const NextLinkWrapper = React.forwardRef(({ addClass, children, href }, ref) => ( - {text} + {children} )) NextLink.propTypes = { - // text: PropTypes.string.isRequired, + children: PropTypes.oneOfType([ + PropTypes.string, + PropTypes.elementType, + ]).isRequired, addClass: PropTypes.string, path: PropTypes.exact({ pathname: PropTypes.string.isRequired, diff --git a/src/components/NextLink/NextLink.stories.jsx b/src/components/NextLink/NextLink.stories.jsx index e838d0e8..f12c501a 100644 --- a/src/components/NextLink/NextLink.stories.jsx +++ b/src/components/NextLink/NextLink.stories.jsx @@ -10,7 +10,7 @@ const Template = (args) => export const Default = Template.bind({}) Default.args = { - text: 'Text Here', + children: 'Text Here', addClass: '', path: { pathname: '/test', diff --git a/src/compounds/Item/CardBody.jsx b/src/compounds/Item/CardBody.jsx index 2c44d048..06a5cc91 100644 --- a/src/compounds/Item/CardBody.jsx +++ b/src/compounds/Item/CardBody.jsx @@ -15,7 +15,7 @@ const CardBody = ({ buttonLink, buttonProps, item, {(withTitleLink) && ( diff --git a/src/compounds/Item/Item.jsx b/src/compounds/Item/Item.jsx index 8a879da6..5b9c2550 100644 --- a/src/compounds/Item/Item.jsx +++ b/src/compounds/Item/Item.jsx @@ -54,26 +54,26 @@ const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, tit
) : ( - {alt} - - - )} - path={{ pathname: item.href, query: { id }}} - addClass="text-decoration-none link-hover" + children={( + <> + {alt} + + + )} + path={{ pathname: item.href, query: { id }}} + addClass="text-decoration-none link-hover" /> )} From 14f6c615cb53087c47709b6407a42cffdb51e3fa Mon Sep 17 00:00:00 2001 From: Alisha Evans Date: Thu, 1 Feb 2024 18:50:19 -0600 Subject: [PATCH 7/7] Update src/compounds/Item/Item.jsx --- src/compounds/Item/Item.jsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compounds/Item/Item.jsx b/src/compounds/Item/Item.jsx index 5b9c2550..035096ca 100644 --- a/src/compounds/Item/Item.jsx +++ b/src/compounds/Item/Item.jsx @@ -57,9 +57,9 @@ const Item = ({ buttonLink, buttonProps, href, isLoading, item, orientation, tit children={( <> {alt}