-
Notifications
You must be signed in to change notification settings - Fork 149
feat(ONYX-1974): add new layout for signup modal #16455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,199 @@ | ||
| import { | ||
| Box, | ||
| Carousel, | ||
| CarouselCell, | ||
| type CarouselCellProps, | ||
| CarouselRail, | ||
| type CarouselRailProps, | ||
| Flex, | ||
| Image, | ||
| THEME, | ||
| } from "@artsy/palette" | ||
| import { useFlag } from "@unleash/proxy-client-react" | ||
| import { MODAL_WIDTH } from "Components/AuthDialog/Utils/utils" | ||
| import { | ||
| type FC, | ||
| forwardRef, | ||
| type ForwardRefExoticComponent, | ||
| useCallback, | ||
| useEffect, | ||
| useRef, | ||
| } from "react" | ||
| import styled from "styled-components" | ||
| import { useCursor } from "use-cursor" | ||
| import { resized } from "Utils/resized" | ||
|
|
||
| export const AuthDialogLeftPanel: FC<React.PropsWithChildren> = () => { | ||
| const img = resized(IMAGE.src, { width: MODAL_WIDTH / 2 }) | ||
|
|
||
| const newSignupEnabled = useFlag("onyx_new-signup-modal") | ||
|
|
||
| if (!newSignupEnabled) { | ||
| return ( | ||
| <Box display={["none", "block"]} width="100%"> | ||
| <Image | ||
| {...img} | ||
| width="100%" | ||
| height="100%" | ||
| lazyLoad | ||
| alt="" | ||
| style={{ objectFit: "cover" }} | ||
| /> | ||
| </Box> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <Box display={["none", "block"]} width="100%" overflow="hidden"> | ||
| <ImageSlider /> | ||
| </Box> | ||
| ) | ||
| } | ||
|
|
||
| const ImageSlider: FC = () => { | ||
| const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null) | ||
|
|
||
| const { index, setCursor } = useCursor({ max: DEFAULT_IMAGES.length }) | ||
|
|
||
| const stopAutoPlay = useCallback(() => { | ||
| intervalRef.current && clearInterval(intervalRef.current) | ||
| }, []) | ||
|
|
||
| useEffect(() => { | ||
| intervalRef.current = setInterval( | ||
| () => setCursor(prevCursor => prevCursor + 1), | ||
| CAROUSEL_INTERVAL, | ||
| ) | ||
|
|
||
| return stopAutoPlay | ||
| }, [setCursor, stopAutoPlay]) | ||
|
|
||
| const handleClick = (index: number) => { | ||
| setCursor(index) | ||
| stopAutoPlay() | ||
| } | ||
|
|
||
| return ( | ||
| <Flex width={COLUMN_WIDTH} height="100%" position="relative"> | ||
| <Carousel | ||
| Cell={Cell} | ||
| Rail={Rail} | ||
| initialIndex={index} | ||
| height="100%" | ||
| display="flex" | ||
| > | ||
| {DEFAULT_IMAGES.map((img, index) => ( | ||
| <Box width={COLUMN_WIDTH} height="100%" key={`signup-img-${img.src}`}> | ||
| <Image | ||
| {...img} | ||
| width="100%" | ||
| height="100%" | ||
| lazyLoad={index !== 0} | ||
| fetchPriority={index === 0 ? "high" : "auto"} | ||
| alt="" | ||
| style={{ | ||
| objectFit: "cover", | ||
| }} | ||
| /> | ||
| </Box> | ||
| ))} | ||
| </Carousel> | ||
|
|
||
| <Flex | ||
| position="absolute" | ||
| p={2} | ||
| bottom={0} | ||
| left={0} | ||
| gap={1} | ||
| flexDirection="column" | ||
| > | ||
| <DotIndicators data-active-index={index}> | ||
| {DEFAULT_IMAGES.map((_, dotIndex) => ( | ||
| <Dot | ||
| key={dotIndex} | ||
| data-index={dotIndex} | ||
| backgroundColor="mono0" | ||
| onClick={() => handleClick(dotIndex)} | ||
| /> | ||
| ))} | ||
| </DotIndicators> | ||
| </Flex> | ||
| </Flex> | ||
| ) | ||
| } | ||
|
|
||
| const Cell: ForwardRefExoticComponent<CarouselCellProps> = forwardRef( | ||
| (props, ref) => { | ||
| return ( | ||
| <CarouselCell | ||
| {...props} | ||
| id="cell" | ||
| ref={ref as any} | ||
| display="inline-flex" | ||
| flex={1} | ||
| width="100%" | ||
| height="100%" | ||
| verticalAlign="top" | ||
| pr={0} | ||
| /> | ||
| ) | ||
| }, | ||
| ) | ||
|
|
||
| const Rail: FC<React.PropsWithChildren<CarouselRailProps>> = props => { | ||
| return ( | ||
| <CarouselRail | ||
| {...props} | ||
| display="flex" | ||
| height="100%" | ||
| width="100%" | ||
| id="carousel-rail" | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| const DotIndicators = styled(Flex)` | ||
| gap: 8px; | ||
| align-items: center; | ||
| ` | ||
|
|
||
| const Dot = styled(Box)` | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| height: 8px; | ||
| transition: width 0.3s ease; | ||
| width: 8px; | ||
|
|
||
| ${DotIndicators}[data-active-index="0"] &[data-index="0"], | ||
| ${DotIndicators}[data-active-index="1"] &[data-index="1"], | ||
| ${DotIndicators}[data-active-index="2"] &[data-index="2"] { | ||
| width: 24px; | ||
| } | ||
| ` | ||
|
|
||
| const CAROUSEL_INTERVAL = 5000 | ||
| const COLUMN_WIDTH = | ||
| MODAL_WIDTH / 2 - Number.parseInt(THEME.space["2"].replace("px", "")) | ||
| const IMAGE_HEIGHT = 2030 | ||
| const IMAGE = { | ||
| width: MODAL_WIDTH, | ||
| height: IMAGE_HEIGHT, | ||
| src: "https://files.artsy.net/images/2x_Evergreen-Artist-Page-Sign-Up-Modal.jpg", | ||
| } | ||
| const DEFAULT_IMAGES = [ | ||
| { | ||
| width: MODAL_WIDTH, | ||
| height: IMAGE_HEIGHT, | ||
| src: "https://files.artsy.net/images/signup-01.png", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This image is still very low quality and has a visible border |
||
| }, | ||
| { | ||
| width: MODAL_WIDTH, | ||
| height: IMAGE_HEIGHT, | ||
| src: "https://files.artsy.net/images/signup-02.png", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still extremely low quality |
||
| }, | ||
| { | ||
| width: MODAL_WIDTH, | ||
| height: IMAGE_HEIGHT, | ||
| src: "https://files.artsy.net/images/signup-03.png", | ||
| }, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These images are extremely low quality and have border artifacts. Also you don't need to convert to webp for their source.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I got new ones from Design, will update in the PR |
||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const MODAL_WIDTH = 900 |
Uh oh!
There was an error while loading. Please reload this page.