diff --git a/client/web/BUILD.bazel b/client/web/BUILD.bazel index 62b2f258d4bb..4388f6048534 100644 --- a/client/web/BUILD.bazel +++ b/client/web/BUILD.bazel @@ -172,6 +172,7 @@ ts_project( "src/app/TauriLink.tsx", "src/app/tauriIcpUtils.ts", "src/auth.ts", + "src/auth/AuthPageWrapper.tsx", "src/auth/CloudSignUpPage.tsx", "src/auth/OrDivider.tsx", "src/auth/PostSignUpPage.tsx", diff --git a/client/web/src/auth/AuthPageWrapper.module.scss b/client/web/src/auth/AuthPageWrapper.module.scss new file mode 100644 index 000000000000..4e8514f37c24 --- /dev/null +++ b/client/web/src/auth/AuthPageWrapper.module.scss @@ -0,0 +1,15 @@ +.logo { + display: block; + width: 4rem; + margin-bottom: 1rem; +} + +.wrapper { + width: 100%; + display: flex; + align-items: center; + /* stylelint-disable declaration-property-unit-allowed-list */ + margin-top: min(20vh, 20rem); + flex-direction: column; + flex: 1 1 auto; +} diff --git a/client/web/src/auth/AuthPageWrapper.tsx b/client/web/src/auth/AuthPageWrapper.tsx new file mode 100644 index 000000000000..4927150360ca --- /dev/null +++ b/client/web/src/auth/AuthPageWrapper.tsx @@ -0,0 +1,47 @@ +import React from 'react' + +import { useIsLightTheme } from '@sourcegraph/shared/src/theme' +import { H1, LinkOrSpan, Text } from '@sourcegraph/wildcard' + +import { BrandLogo } from '../components/branding/BrandLogo' + +import styles from './AuthPageWrapper.module.scss' + +interface Props { + /** Title of the page. */ + title: string + /** Optional second line item. */ + description?: string + sourcegraphDotComMode: boolean + className?: string +} + +export type AuthPageWrapperProps = React.PropsWithChildren + +export const AuthPageWrapper: React.FunctionComponent = ({ + title, + description, + sourcegraphDotComMode, + className, + children, +}) => { + const isLightTheme = useIsLightTheme() + + return ( + <> +
+ + + +

{title}

+ {description && {description}} +
{children}
+
+ + ) +} diff --git a/client/web/src/auth/CloudSignUpPage.module.scss b/client/web/src/auth/CloudSignUpPage.module.scss index 23f020e1abbe..26ca6f2125a4 100644 --- a/client/web/src/auth/CloudSignUpPage.module.scss +++ b/client/web/src/auth/CloudSignUpPage.module.scss @@ -112,8 +112,3 @@ height: 3rem !important; flex-shrink: 0; } - -.externals-auth-button { - background: var(--white); - color: var(--black) !important; -} diff --git a/client/web/src/auth/CloudSignUpPage.story.tsx b/client/web/src/auth/CloudSignUpPage.story.tsx index 54830bc5f482..c27d45a06e68 100644 --- a/client/web/src/auth/CloudSignUpPage.story.tsx +++ b/client/web/src/auth/CloudSignUpPage.story.tsx @@ -32,6 +32,14 @@ const context: Pick ) diff --git a/client/web/src/auth/OrDivider.story.tsx b/client/web/src/auth/OrDivider.story.tsx index eca9383b014c..9d502b31b8db 100644 --- a/client/web/src/auth/OrDivider.story.tsx +++ b/client/web/src/auth/OrDivider.story.tsx @@ -9,7 +9,7 @@ import { OrDivider } from './OrDivider' const decorator: DecoratorFn = story =>
{story()}
const config: Meta = { - title: 'web/OrDivider', + title: 'web/auth/OrDivider', decorators: [decorator], } diff --git a/client/web/src/auth/PostSignUpPage.story.tsx b/client/web/src/auth/PostSignUpPage.story.tsx index d16b94862dc0..4cc0f1f7f5d7 100644 --- a/client/web/src/auth/PostSignUpPage.story.tsx +++ b/client/web/src/auth/PostSignUpPage.story.tsx @@ -6,7 +6,7 @@ import { WebStory } from '../components/WebStory' import { PostSignUpPage } from './PostSignUpPage' const config: Meta = { - title: 'web/src/auth/PostSignUpPage', + title: 'web/auth/PostSignUpPage', } export default config diff --git a/client/web/src/auth/RequestAccessPage.module.scss b/client/web/src/auth/RequestAccessPage.module.scss new file mode 100644 index 000000000000..9f591d6f94a7 --- /dev/null +++ b/client/web/src/auth/RequestAccessPage.module.scss @@ -0,0 +1,3 @@ +.wrapper { + width: 27.5rem; +} diff --git a/client/web/src/auth/RequestAccessPage.story.tsx b/client/web/src/auth/RequestAccessPage.story.tsx new file mode 100644 index 000000000000..b6a9f28c1e5a --- /dev/null +++ b/client/web/src/auth/RequestAccessPage.story.tsx @@ -0,0 +1,17 @@ +import type { Meta, Story } from '@storybook/react' + +import { WebStory } from '../components/WebStory' + +import { RequestAccessPage } from './RequestAccessPage' + +const config: Meta = { + title: 'web/auth/RequestAccessPage', +} + +export default config + +export const Default: Story = () => {() => } + +export const Done: Story = () => ( + {() => } +) diff --git a/client/web/src/auth/RequestAccessPage.tsx b/client/web/src/auth/RequestAccessPage.tsx index 029c591a57ad..2d79eb4a5aee 100644 --- a/client/web/src/auth/RequestAccessPage.tsx +++ b/client/web/src/auth/RequestAccessPage.tsx @@ -1,23 +1,22 @@ import React, { useEffect, useState } from 'react' -import classNames from 'classnames' import { Navigate, Route, Routes, useLocation, useNavigate } from 'react-router-dom' -import { Text, Link, ErrorAlert, Form, Input, Button, LoadingSpinner, TextArea, Label } from '@sourcegraph/wildcard' +import { Text, Link, ErrorAlert, Form, Input, TextArea, Container, Alert } from '@sourcegraph/wildcard' -import { HeroPage } from '../components/HeroPage' +import { LoaderButton } from '../components/LoaderButton' import { PageTitle } from '../components/PageTitle' import type { SourcegraphContext } from '../jscontext' import { PageRoutes } from '../routes.constants' import { eventLogger } from '../tracking/eventLogger' import { checkRequestAccessAllowed } from '../util/checkRequestAccessAllowed' -import { SourcegraphIcon } from './icons' +import { AuthPageWrapper } from './AuthPageWrapper' import { getReturnTo } from './SignInSignUpCommon' -import RequestAccessSignUpCommonStyles from './SignInSignUpCommon.module.scss' +import styles from './RequestAccessPage.module.scss' -interface RequestAccessFormProps { +export interface RequestAccessFormProps { onSuccess: () => void onError: (error?: any) => void xhrHeaders: SourcegraphContext['xhrHeaders'] @@ -69,59 +68,50 @@ const RequestAccessForm: React.FunctionComponent = ({ on } } return ( -
- - -