diff --git a/packages/component-events/README.md b/packages/component-events/README.md index 1c8624e08a..69b0a36ad8 100644 --- a/packages/component-events/README.md +++ b/packages/component-events/README.md @@ -3,7 +3,6 @@ ASU Web Standards-based implementation of events component. This component is the React implementation of the old D8 Events component(https://github.com/ASU-CLAS/asu-react-d8events) but reusing a lot of the components already developed in `components-core` and `component-carousel`, taking in cosideration good practises, scalability and performance. - The job of this component is listing all the events fetched to the api url provided by the user. It also display a customizable, optional header with a title and a button. ## Architecture details diff --git a/packages/component-news/README.md b/packages/component-news/README.md index 68f6326e48..e277128e8b 100644 --- a/packages/component-news/README.md +++ b/packages/component-news/README.md @@ -3,6 +3,7 @@ ASU Web Standards-based implementation of news component. This component is the React implementation of the old News component(https://github.com/ASU-CLAS/asu-react-news-list) but reusing a lot of the components already developed in `components-core` and `component-carousel`, taking in cosideration good practises, scalability and performance. + The job of this component is listing all the news fetched to the api url provided by the user. It also display a customizable, optional header with a title and a button. ## Architecture details diff --git a/packages/unity-bootstrap-theme/src/scss/extends/_cards.scss b/packages/unity-bootstrap-theme/src/scss/extends/_cards.scss index 398f345201..4d6bbc963c 100644 --- a/packages/unity-bootstrap-theme/src/scss/extends/_cards.scss +++ b/packages/unity-bootstrap-theme/src/scss/extends/_cards.scss @@ -228,6 +228,8 @@ Cards - Table of Contents // } // } + + @include media-breakpoint-up(lg) { .col-lg-6 .card { .card-img-top { @@ -435,6 +437,66 @@ Cards - Table of Contents margin-right: 8px; } +/* + Arrow link CTA for event and news cards. + Replaces button CTAs with a single right-arrow link. +*/ +.card-arrow-link { + align-items: center; + justify-content: center; + width: 2.1rem; + height: 2.1rem; + float: right; + color: $asu-gray-2; + text-decoration: none; + border-radius: 50%; + border: 2px solid transparent; + display: flex !important; + align-items: center; + justify-content: center; + + &:hover, &:focus, &:focus-visible, &:active { + box-shadow: $uds-color-base-maroon; + .fa-arrow-right { + color: $uds-color-base-maroon; + } + } + + .fa-arrow-right { + width: .875rem; + height: .875rem; + color: $asu-gray-4; + } + + &:hover { + color: $uds-color-base-maroon; + } + + &:focus-visible { + outline: 2px solid $uds-color-base-bluefocus; + outline-offset: 2px; + } + + @include media-breakpoint-down(md) { + color: $uds-color-base-maroon; + border-color: $uds-color-base-maroon; + + &::before { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + } + + .fa-arrow-right { + color: inherit; + } + + } +} + .card-horizontal { flex-direction: row; } diff --git a/packages/unity-react-core/src/components/Card/Card.jsx b/packages/unity-react-core/src/components/Card/Card.jsx index 990516f3fe..8bdca8093c 100644 --- a/packages/unity-react-core/src/components/Card/Card.jsx +++ b/packages/unity-react-core/src/components/Card/Card.jsx @@ -20,6 +20,8 @@ const gaDefaultObject = { region: "main content", }; +const isEventOrNewsCard = (type) => type === "event" || type === "news"; + /** * @typedef {import('../../core/types/card-types').CardProps} CardProps */ @@ -185,58 +187,43 @@ const BaseCard = ({ [`borderless`]: !showBorders, }); + const shouldShowImage = isEventOrNewsCard(type) ? !!image : true; + const shouldIncludeCardLink = !isEventOrNewsCard(type); + return ( - <> - - {!!image && ( - {imageAltText} - )} - {!image && icon && ( - - )} - {horizontal ? ( -
- -
- ) : ( - - )} -
- + + {shouldShowImage && ( + {imageAltText} + )} + {!image && icon && ( + + )} +
+ +
+
); }; @@ -291,83 +278,107 @@ const CardContent = ({ linkUrl = undefined, tags = undefined, cardLink, -}) => ( - <> - {!!title && ( +}) => { + const isEventOrNews = isEventOrNewsCard(type); + const showTitleLink = cardLink && !isEventOrNews; + const showArrowLink = isEventOrNews && cardLink; + const showEventInfo = type === "event" && (eventTime || eventLocation); + + return ( + <>

- {cardLink ? {title} : title} + {showTitleLink ? {title} : title}

- )} - {!!body && ( -
- {} -
-
- )} - {type === "event" && (eventTime || eventLocation) && ( - - )} - {buttons && ( -
- {buttons.map(button => ( -
+
+
+ )} + {showEventInfo && ( + + )} + {showArrowLink ? ( +
+ - {/* @ts-ignore */} -