From 231315a3083df84155788093c6815bf263ac234f Mon Sep 17 00:00:00 2001 From: Gjore Milevski Date: Fri, 8 Nov 2024 11:02:42 +0100 Subject: [PATCH] Make carousel feature available for EIC --- common/styles.scss | 39 ++ overrides/home/carousel/carousel-item.tsx | 75 ++++ overrides/home/carousel/index.scss | 44 ++ overrides/home/carousel/index.tsx | 114 +++++ overrides/home/carousel/items.js | 22 + overrides/home/component.tsx | 10 +- package.json | 4 +- yarn.lock | 487 +++++----------------- 8 files changed, 411 insertions(+), 384 deletions(-) create mode 100644 common/styles.scss create mode 100644 overrides/home/carousel/carousel-item.tsx create mode 100644 overrides/home/carousel/index.scss create mode 100644 overrides/home/carousel/index.tsx create mode 100644 overrides/home/carousel/items.js diff --git a/common/styles.scss b/common/styles.scss new file mode 100644 index 000000000..f3c33c506 --- /dev/null +++ b/common/styles.scss @@ -0,0 +1,39 @@ +.blocklink { + &:focus { outline: none; } + &:focus-visible { outline: 1px solid var(--veda-color-link);} + @supports not selector(:focus-visible) { + &:focus { + outline: 1px solid var(--veda-color-link); + } + } + } + + .hug-reset-container { + grid-column: 1 / -1; + } + + .card-shadow__hover { + box-shadow: 0 0 2px 0 rgba(44,62,80,0.08),0 6px 6px 0 rgba(44,62,80,0.08); + transition: all 0.24s ease-in-out 0s; + &:hover { + transform: translate(0, 0.125rem); + } + } + + .card-image__blend { + mix-blend-mode: multiply; + } + + .veda-color--link { + color: var(--veda-color-link); + } + .veda-color--base { + color: var(--veda-color-base); + } + + // font-size: 20px (1.25rem) will be deprecated with USWDS design system + // but we need a temporary style class for the consistency across the pages + + .font-size-md-deprecated { + font-size: calc(1rem + var(--base-text-increment, 0rem)); + } \ No newline at end of file diff --git a/overrides/home/carousel/carousel-item.tsx b/overrides/home/carousel/carousel-item.tsx new file mode 100644 index 000000000..fceb6fc5d --- /dev/null +++ b/overrides/home/carousel/carousel-item.tsx @@ -0,0 +1,75 @@ +import React from '$veda-ui/react'; +import styled from '$veda-ui/styled-components'; +import { Button, Icon } from '$veda-ui/@trussworks/react-uswds'; + +import { + Card, + CardBody, + CardFooter, +} from '$veda-ui/@trussworks/react-uswds'; + + +const progressColor = '#1565EF'; + +const ProgressIndicator = styled.div` + background-color: ${progressColor}; + width: ${props => props.progressWidth}%; + transition: ${props => props.noTransition? null: 'width 200ms ease-out'}; +`; + +function ProgressBar({ selected, shouldProgress, progressDone, progressPercentage }) { + // If progress is done, 100% - false if something is manually selected + // If it is in progress, progress Percentage - false if something is manually selected + // If it is manually selected, 100% + const progressWidth = progressDone? 100: shouldProgress? progressPercentage: selected? 100: 0; + const noTransition = (!shouldProgress && !progressDone && progressPercentage === 0)? true : false; + + return <> +
+ +
+ +} + +export function ItemPanel({ item, linkComponent: LinkComponent }) { + return (<> + +
+

{item.description}

+ + + Read more + +
+ ) +} + +export default function CarouselItem({ item, itemIdx, onTitleClick, shouldProgress, progressDone, progressPercentage, selected, linkComponent: LinkComponent }) { + return + + +

+ {item.title} +

+

{item.description}

+