Skip to content

Commit

Permalink
Fix button colour logic with new prop
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyEPhipps committed Oct 4, 2023
1 parent fa20eb2 commit dcba1ae
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/components/Molecules/Promo/Promo.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const Promo = ({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const whiteButtonDebug = true; // to-do: suss out how this relates in context
const lightVideo = false; // to-do: suss out how this relates in context

return (
<Container backgroundColor={backgroundColor} position={position}>
Expand Down Expand Up @@ -105,7 +105,7 @@ const Promo = ({
videoProgress={videoProgress}
togglePlay={togglePlay}
isPlaying={isPlaying}
whiteButton={whiteButtonDebug}
lightVideo={lightVideo}
/>
</Media>
)}
Expand Down Expand Up @@ -145,6 +145,7 @@ Promo.defaultProps = {
loop: true,
video: false,
showPosterAfterPlaying: true

};

export default Promo;
40 changes: 40 additions & 0 deletions src/components/Molecules/Promo/Promo.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,5 +324,45 @@ const src =
</Link>
</span>
</Promo>

<Text tag="h2" size="xl" color="black">
Promo None w/Video (no loop or autoplay, DARK text albeit the same video)
</Text>
<Promo
backgroundColor="blue_dark"
imageSet={defaultData.promoImage}
image={defaultData.promoImage}
imageLow={defaultData.promoImage}
imageAltText=""
copyLeft={true}
hasOverlay={true}
video={src}
poster={poster}
loop={false}
autoPlay={false}
>
<Text
tag="h1"
color="black"
size="super"
family="Anton"
uppercase
weight="normal"
>
Curabitur pretium tincidunt lacus
</Text>
<Text tag="p" color="black">
Curabitur pretium tincidunt lacus. Nulla gravida orci a odio. Nullam varius,
turpis et commodo, est eros bibendum elit, nec luctus magna sollicitudin.
</Text>
<span>
<Link href="/" type="button" color="black">
<Text>
Show me this
</Text>
</Link>
</span>
</Promo>

</div>
```
20 changes: 12 additions & 8 deletions src/components/Molecules/Promo/_PromoVideoButton.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ const PlayButton = styled.button`
border-radius: 50%;
background: black;
${({ whiteButton }) => whiteButton && css`
// DARK VIDEO:
${({ lightVideo }) => !lightVideo && css`
background: ${({ theme }) => theme.color('white')};
`}
Expand Down Expand Up @@ -79,7 +80,8 @@ const ProgressRingCircle = styled.circle`
stroke: white; // need to changed based on Promo settings
fill: transparent;
${({ whiteButton }) => whiteButton && css`
// DARK VIDEO, WHITE BUTTON SO STROKE IS WHITE:
${({ lightVideo }) => !lightVideo && css`
stroke: ${({ theme }) => theme.color('black')};
`}
`;
Expand All @@ -89,23 +91,25 @@ const Icon = styled.span`
width: 50px;
background: no-repeat center/50% url(${playWhite}) transparent;
${({ whiteButton, isPlaying }) => (!whiteButton && !isPlaying) && css`
// LIGHT VIDEO, BLACK BUTTON SO ICONS ARE WHITE
${({ lightVideo, isPlaying }) => (lightVideo && !isPlaying) && css`
background-image: url(${playWhite});
`}
${({ whiteButton, isPlaying }) => (!whiteButton && isPlaying) && css`
// LIGHT VIDEO, BLACK BUTTON SO ICONS ARE WHITE
${({ lightVideo, isPlaying }) => (lightVideo && isPlaying) && css`
background-image: url(${pauseWhite});
`}
${({ whiteButton, isPlaying }) => (whiteButton && !isPlaying) && css`
// DARK VIDEO, WHITE BUTTON SO ICONS ARE BLACK
${({ lightVideo, isPlaying }) => (!lightVideo && !isPlaying) && css`
background-image: url(${playBlack});
`}
${({ whiteButton, isPlaying }) => (whiteButton && isPlaying) && css`
// DARK VIDEO, WHITE BUTTON SO ICONS ARE BLACK
${({ lightVideo, isPlaying }) => (!lightVideo && isPlaying) && css`
background-image: url(${pauseBlack});
`}
`;

export {
Expand Down

0 comments on commit dcba1ae

Please sign in to comment.