Skip to content

Commit

Permalink
Port over Back Button (#54)
Browse files Browse the repository at this point in the history
* back button component

* back button in getting started pages

* prettier

* linting
  • Loading branch information
bretthayes authored Mar 29, 2022
1 parent 9207db6 commit d8e3269
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 79 deletions.
19 changes: 19 additions & 0 deletions src/components/BackButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { FunctionComponent } from 'react'

import ArrowLeftIcon from 'mdi-react/ArrowLeftIcon'
import Link from 'next/link'

interface BackButtonProps {
href: string
text: string
bold?: boolean
}

export const BackButton: FunctionComponent<BackButtonProps> = ({ href, text, bold }) => (
<Link href={href} passHref={true}>
<div className="btn p-0 text-uppercase mb-3 font-weight-normal">
<ArrowLeftIcon className="mb-1" />
<span className={`h6 font-weight-${bold ? 'bold' : 'normal'} ml-3`}>{text}</span>
</div>
</Link>
)
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export { RequestDemoForm } from './RequestDemoForm'
export { TrySourcegraph } from './TrySourcegraph'
export { Install } from './Install'
export { EmbeddedHubSpot } from './HubSpot'
export { BackButton } from './BackButton'
export { FormLegal } from './FormLegal'

// Actions
Expand Down
9 changes: 5 additions & 4 deletions src/pages/get-started/cloud.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ import { FunctionComponent } from 'react'
import ArrowRightIcon from 'mdi-react/ArrowRightIcon'
import Link from 'next/link'

import { Layout } from '@components'
import { Layout, BackButton } from '@components'
import { useQueryString } from '@hooks'

import { BackButton } from './self-hosted'

import { BestForTitle } from '.'

import styles from './getStarted.module.scss'
Expand Down Expand Up @@ -37,7 +35,10 @@ export const CloudPage: FunctionComponent = () => {
<div className="row container-xl mx-auto py-5">
<div className="col-lg-6">
<div>
<BackButton />
<BackButton
href={`/get-started${routerHook.queryString ? `?${routerHook.queryString}` : ''}`}
text="Deployment Options"
/>

<h1 className="display-2 font-weight-bolder mb-4">Sourcegraph Cloud</h1>

Expand Down
143 changes: 68 additions & 75 deletions src/pages/get-started/self-hosted.tsx
Original file line number Diff line number Diff line change
@@ -1,93 +1,86 @@
import { FunctionComponent } from 'react'

import ArrowLeftIcon from 'mdi-react/ArrowLeftIcon'
import ArrowRightIcon from 'mdi-react/ArrowRightIcon'
import { useRouter } from 'next/router'

import { Layout, Install } from '@components'
import { Layout, Install, BackButton } from '@components'
import { useQueryString } from '@hooks'

import { BestForTitle, MostPopularBadge } from '.'

import styles from './getStarted.module.scss'

export const BackButton: FunctionComponent = () => {
const router = useRouter()
export const SelfHostedPage: FunctionComponent = () => {
const routerHook = useQueryString()

return (
<div className="d-flex align-items-center btn p-0 text-uppercase mb-3 font-weight-normal">
<button className="btn p-0 text-uppercase font-weight-normal" type="button" onClick={() => router.back()}>
<ArrowLeftIcon className="mb-1" />
</button>
<span className="h6 font-weight-normal ml-3 mb-0">Deployment Options</span>
</div>
)
}

export const SelfHostedPage: FunctionComponent = () => (
<Layout
meta={{
title: 'Get Started with Sourcegraph Self-Hosted',
description:
'Deploy and control Sourcegraph in your own infrastructure, or use Docker to install locally. Get started for free.',
}}
hero={
<div className="container-xl py-5">
<h1 className="display-1 mb-2">
<strong>What's best for you?</strong>
</h1>
<p>From Amazon to Uber, the world's best developers use Sourcegraph every day.</p>
</div>
}
heroAndHeaderClassName={styles.hero}
hideGetStartedButton={true}
>
<div className={`${styles.root} bg-gradient-blue-purple py-5`}>
<div className="row container-xl mx-auto py-5">
<div className="col-lg-6">
<div>
<BackButton />

<h1 className="display-2 font-weight-bolder mb-2">
Sourcegraph <br />
Self-Hosted
</h1>

<MostPopularBadge />

<p className="mt-4">
Deploy and control Sourcegraph in your own infrastructure, or use Docker to install locally.
Get started for free.
</p>

<BestForTitle />
<p>Teams and enterprises</p>

<p>
Collaborate with your team on any code host (including private hosts) and access advanced
security functionality.
</p>
</div>
<Layout
meta={{
title: 'Get Started with Sourcegraph Self-Hosted',
description:
'Deploy and control Sourcegraph in your own infrastructure, or use Docker to install locally. Get started for free.',
}}
hero={
<div className="container-xl py-5">
<h1 className="display-1 mb-2">
<strong>What's best for you?</strong>
</h1>
<p>From Amazon to Uber, the world's best developers use Sourcegraph every day.</p>
</div>
}
heroAndHeaderClassName={styles.hero}
hideGetStartedButton={true}
>
<div className={`${styles.root} bg-gradient-blue-purple py-5`}>
<div className="row container-xl mx-auto py-5">
<div className="col-lg-6">
<div>
<BackButton
href={`/get-started${routerHook.queryString ? `?${routerHook.queryString}` : ''}`}
text="Deployment Options"
/>

<h1 className="display-2 font-weight-bolder mb-2">
Sourcegraph <br />
Self-Hosted
</h1>

<MostPopularBadge />

<p className="mt-4">
Deploy and control Sourcegraph in your own infrastructure, or use Docker to install
locally. Get started for free.
</p>

<BestForTitle />
<p>Teams and enterprises</p>

<p>
Collaborate with your team on any code host (including private hosts) and access
advanced security functionality.
</p>
</div>
</div>

<div className="col-lg-6">
<Install />

<div className="d-flex flex-column align-items-start">
<a
className="btn p-0 my-4 text-primary"
href="https://info.sourcegraph.com/talk-to-a-developer"
>
Talk to an engineer <ArrowRightIcon />
</a>

<a className="btn p-0 text-primary" href="https://docs.sourcegraph.com/">
Deploy to a server or cluster <ArrowRightIcon />
</a>
<div className="col-lg-6">
<Install />

<div className="d-flex flex-column align-items-start">
<a
className="btn p-0 my-4 text-primary"
href="https://info.sourcegraph.com/talk-to-a-developer"
>
Talk to an engineer <ArrowRightIcon />
</a>

<a className="btn p-0 text-primary" href="https://docs.sourcegraph.com/">
Deploy to a server or cluster <ArrowRightIcon />
</a>
</div>
</div>
</div>
</div>
</div>
</Layout>
)
</Layout>
)
}

export default SelfHostedPage

0 comments on commit d8e3269

Please sign in to comment.