Skip to content
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

[Sign up Redesign] Sign up white screens footer (web); add shadow mid inver to Harmony C-3358 C-3359ted #6671

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions packages/harmony/src/foundations/shadows/Shadow.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export function ShadowLevel(props) {
<Flex justifyContent='space-between'>
<ShadowLevel shadow='near' />
<ShadowLevel shadow='mid' />
<ShadowLevel shadow='midInverted' />
<ShadowLevel shadow='far' />
<ShadowLevel shadow='emphasis' />
<ShadowLevel
Expand All @@ -80,13 +81,14 @@ export function ShadowLevel(props) {
</Flex>
</Unstyled>

| Name | Description |
| --------------- | ------------------------------------------------------------------------------------------------- |
| shadow-near | Optimal for onPress states on cards. |
| shadow-mid | Used for smaller card elements and the default state for card elements with a hover interaction. |
| shadow-far | Used for hover state for card elements, larger cards/sections without hover states, and modals |
| shadow-emphasis | Used for separating elements from their background |
| shadow-special | Shadow derived from the dominate color of the artwork it’s surrounding. Used for playing artwork. |
| Name | Description |
| ------------------- | ------------------------------------------------------------------------------------------------- |
| shadow-near | Optimal for onPress states on cards. |
| shadow-mid | Used for smaller card elements and the default state for card elements with a hover interaction. |
| shadow-mid-inverted | This is the same as mid but with the values offset the other direction. |
| shadow-far | Used for hover state for card elements, larger cards/sections without hover states, and modals |
| shadow-emphasis | Used for separating elements from their background |
| shadow-special | Shadow derived from the dominate color of the artwork it’s surrounding. Used for playing artwork. |

## Usage and examples

Expand Down
2 changes: 2 additions & 0 deletions packages/harmony/src/foundations/shadows/shadows.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ root {
0px 0px 6px 0px rgba(0, 0, 0, 0.02);
--harmony-shadow-mid: 0px 4px 8px 0px rgba(0, 0, 0, 0.06),
0px 0px 4px 0px rgba(0, 0, 0, 0.04);
--harmony-shadow-mid-inverted: 0px -4px 8px 0px rgba(0, 0, 0, 0.06),
0px 0px 4px 0px rgba(0, 0, 0, 0.04);
--harmony-shadow-far: 0px 8px 16px 0px rgba(0, 0, 0, 0.08),
0px 0px 4px 0px rgba(0, 0, 0, 0.04);
--harmony-shadow-emphasis: 0px 1.34018px 8px 0px rgba(0, 0, 0, 0.2),
Expand Down
2 changes: 2 additions & 0 deletions packages/harmony/src/foundations/shadows/shadows.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export const shadows = {
near: '0px 2px 4px 0px rgba(0, 0, 0, 0.08), 0px 0px 6px 0px rgba(0, 0, 0, 0.02)',
mid: '0px 4px 8px 0px rgba(0, 0, 0, 0.06), 0px 0px 4px 0px rgba(0, 0, 0, 0.04)',
midInverted:
'0px -4px 8px 0px rgba(0, 0, 0, 0.06), 0px 0px 4px 0px rgba(0, 0, 0, 0.04)',
far: '0px 8px 16px 0px rgba(0, 0, 0, 0.08), 0px 0px 4px 0px rgba(0, 0, 0, 0.04)',
emphasis:
'0px 1.34018px 8px 0px rgba(0, 0, 0, 0.2), 0px 6px 15px 0px rgba(0, 0, 0, 0.1)',
Expand Down
7 changes: 7 additions & 0 deletions packages/web/src/pages/sign-up-page/SignUpRootPage.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.container {
height: 100%;
}

.whitePageContainer {
height: 100%;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use <Box w='100%'> or h='100%' for these and similar uses below

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooh thanks!

5 changes: 3 additions & 2 deletions packages/web/src/pages/sign-up-page/SignUpRootPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
TRENDING_PAGE
} from 'utils/route'

import styles from './SignUpRootPage.module.css'
import { ProgressHeader } from './components/ProgressHeader'
import { CreatePasswordPage } from './pages/CreatePasswordPage'
import { FinishProfilePage } from './pages/FinishProfilePage'
Expand All @@ -34,7 +35,7 @@ const determineAllowedRoute = (
) => {
const attemptedPath = requestedRoute.replace('/signup/', '')
// Have to type as string[] to avoid too narrow of a type for comparing against
let allowedRoutes: string[] = [SignUpPath.createEmail] // create email is available by default
let allowedRoutes: string[] = [SignUpPath.createEmail, SignUpPath.pickHandle] // create email is available by default
if (signUpState.email.value) {
// Already have email
allowedRoutes.push(SignUpPath.createPassword)
Expand Down Expand Up @@ -103,7 +104,7 @@ export function SignUpRoute({ children, ...rest }: RouteProps) {

export const SignUpRootPage = () => {
return (
<div>
<div className={styles.container}>
<Switch>
<SignUpRoute exact path={SIGN_UP_EMAIL_PAGE}>
<SignUpPage />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.container {
box-shadow: var(--harmony-shadow-mid-inverted);
width: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add w='100%' shadow='midInverted' to the Flex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg nice

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's also an emotion css prop if you wanna pass in the non-standard stuff and have no css file

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh ok good to know!

position: sticky;
bottom: 0;
}
22 changes: 22 additions & 0 deletions packages/web/src/pages/sign-up-page/components/ContinueFooter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { PropsWithChildren } from 'react'

import { Flex } from '@audius/harmony'

import styles from './ContinueFooter.module.css'

type ContinueFooterProps = PropsWithChildren<{}>

export const ContinueFooter = ({ children }: ContinueFooterProps) => {
return (
<Flex
pv='l'
justifyContent='center'
gap='l'
alignItems='center'
direction='column'
className={styles.container}
>
{children}
</Flex>
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
.container {
.outerContainer {
height: 100%;
}

.contentContainer {
max-width: 610px;
margin: 0 auto;
}
Expand Down
125 changes: 77 additions & 48 deletions packages/web/src/pages/sign-up-page/pages/PickHandlePage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { useCallback, useContext, useEffect, useMemo, useRef } from 'react'

import { AudiusQueryContext, useDebouncedCallback } from '@audius/common'
import { Box, Button, Flex, Text } from '@audius/harmony'
import {
Box,
Button,
Flex,
IconArrowRight,
PlainButton,
PlainButtonType,
Text
} from '@audius/harmony'
import { Form, Formik, FormikProps, useFormikContext } from 'formik'
import { isEmpty } from 'lodash'
import { useDispatch, useSelector } from 'react-redux'
Expand All @@ -13,8 +21,9 @@ import { getHandleField } from 'common/store/pages/signon/selectors'
import { HarmonyTextField } from 'components/form-fields/HarmonyTextField'
import { useNavigateToPage } from 'hooks/useNavigateToPage'
import { audiusBackendInstance } from 'services/audius-backend/audius-backend-instance'
import { SIGN_UP_FINISH_PROFILE_PAGE } from 'utils/route'
import { SIGN_UP_FINISH_PROFILE_PAGE, SIGN_UP_PASSWORD_PAGE } from 'utils/route'

import { ContinueFooter } from '../components/ContinueFooter'
import {
generateHandleSchema,
errorMessages as handleErrorMessages
Expand All @@ -30,6 +39,7 @@ const messages = {
handle: 'Handle',
continue: 'Continue',
linkToClaim: 'Link to claim.',
goBack: 'Go Back',
...handleErrorMessages
}

Expand Down Expand Up @@ -101,6 +111,10 @@ export const PickHandlePage = () => {

const { value } = useSelector(getHandleField)

const handleClickBackIcon = useCallback(() => {
navigate(SIGN_UP_PASSWORD_PAGE)
}, [navigate])

const handleSubmit = useCallback(
(values: PickHandleValues) => {
const { handle } = values
Expand All @@ -115,53 +129,68 @@ export const PickHandlePage = () => {
}

return (
<Box pv='3xl' className={styles.container}>
<Formik
innerRef={formikRef}
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={handleSubmit}
validateOnChange={false}
>
{({ isSubmitting, isValid, isValidating }) => (
<Form>
<Box>
<Flex gap='l' direction='column'>
<Box>
<Text size='s' variant='label' color='subdued'>
1 {messages.outOf} 2
</Text>
</Box>
<Box>
<Text
color='heading'
size='l'
strength='default'
variant='heading'
>
{messages.pickYourHandle}
</Text>
</Box>
<Box>
<Text size='l' variant='body'>
{messages.handleDescription}
</Text>
<Formik
innerRef={formikRef}
initialValues={initialValues}
validationSchema={validationSchema}
onSubmit={handleSubmit}
validateOnChange={false}
>
{({ isSubmitting, isValid, isValidating }) => (
<Flex
direction='column'
className={styles.outerContainer}
justifyContent='space-between'
>
<Box pv='3xl' className={styles.contentContainer}>
<Form>
<Box>
<Flex gap='l' direction='column'>
<Box>
<Text size='s' variant='label' color='subdued'>
1 {messages.outOf} 2
</Text>
</Box>
<Box>
<Text
color='heading'
size='l'
strength='default'
variant='heading'
>
{messages.pickYourHandle}
</Text>
</Box>
<Box>
<Text size='l' variant='body'>
{messages.handleDescription}
</Text>
</Box>
</Flex>
<Box mt='2xl'>
<HandleField />
</Box>
</Flex>
<Box mt='2xl'>
<HandleField />
</Box>
<Button
type='submit'
disabled={!isValid || isSubmitting}
isLoading={isSubmitting || isValidating}
>
{messages.continue}
</Button>
</Box>
</Form>
)}
</Formik>
</Box>
</Form>
</Box>
<ContinueFooter>
<Button
type='submit'
disabled={!isValid || isSubmitting}
isLoading={isSubmitting || isValidating}
iconRight={IconArrowRight}
>
{messages.continue}
</Button>
<PlainButton
onClick={handleClickBackIcon}
variant={PlainButtonType.SUBDUED}
>
{messages.goBack}
</PlainButton>
</ContinueFooter>
</Flex>
)}
</Formik>
)
}