Skip to content
This repository was archived by the owner on Apr 19, 2021. It is now read-only.

Commit 2c0a48f

Browse files
committed
update get started section.
Fixes gitpod-io/website#819
1 parent 42f81ca commit 2c0a48f

File tree

11 files changed

+116
-412
lines changed

11 files changed

+116
-412
lines changed

src/components/MoreInfo.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { borders, sizes } from '../styles/variables'
55
import { Link } from 'gatsby'
66
import MapGrey from '../resources/map-grey.svg'
77

8+
const StyledMoreInfo = styled.div<{negativeSpaceTop?: string}>`
9+
@media(min-width: calc(${sizes.breakpoints.md} + 1px)) {
10+
margin-top: ${({negativeSpaceTop}) => negativeSpaceTop };
11+
}
12+
`
13+
814
const StyledPricingLinks = styled.section`
915
max-width: 850px;
1016
display: flex;
@@ -62,9 +68,10 @@ export interface PricingLinksProps {
6268
text?: JSX.Element
6369
links?: JSX.Element
6470
backgroundShouldBeWhite?: boolean
71+
negativeSpaceTop?: string
6572
}
6673

67-
const PricingLinks = ({ img, title, text, links, backgroundShouldBeWhite }: PricingLinksProps) => {
74+
const PricingLinks = ({ img, title, text, links, backgroundShouldBeWhite, negativeSpaceTop }: PricingLinksProps) => {
6875
let Img = img
6976
let Title = title
7077
let Text = text
@@ -89,9 +96,10 @@ const PricingLinks = ({ img, title, text, links, backgroundShouldBeWhite }: Pric
8996
)
9097
}
9198
return (
92-
<div
99+
<StyledMoreInfo
93100
className="pattern-bg"
94-
style={{ marginBottom: backgroundShouldBeWhite ? '' : '10rem', background: backgroundShouldBeWhite ? 'none' : '' }}
101+
style={{ marginBottom: backgroundShouldBeWhite ? '' : '10rem', background: backgroundShouldBeWhite ? 'none' : ''}}
102+
negativeSpaceTop={negativeSpaceTop}
95103
>
96104
<div className="row">
97105
<StyledPricingLinks>
@@ -103,7 +111,7 @@ const PricingLinks = ({ img, title, text, links, backgroundShouldBeWhite }: Pric
103111
</div>
104112
</StyledPricingLinks>
105113
</div>
106-
</div>
114+
</StyledMoreInfo>
107115
)
108116
}
109117

src/components/gitpod-vs-codespaces/Difference.tsx

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,65 @@
11
import React, { useEffect, useState } from 'react'
22
import styled from '@emotion/styled'
3+
import Chrome from '../../resources/chrome-logo.svg'
4+
import Firefox from '../../resources/firefox-logo.svg'
5+
import { getBrowser } from '../../utils/helpers'
36

4-
const getBrowser = (userAgent: string) => {
5-
const browsers = ['Opera', 'Chrome', 'Firefox', 'IE']
6-
let browser
7-
8-
browsers.forEach((b) => {
9-
if (userAgent.indexOf(b) !== -1) {
10-
browser = b
11-
}
12-
})
13-
14-
return browser
15-
}
16-
17-
const StyledDifference = styled.section`
7+
const StyledDifference = styled.section<{spacing?: 'small'}>`
8+
padding: ${({spacing}) => spacing === 'small' ? '6rem 0' : ''};
189
text-align: center;
1910
2011
p {
2112
font-size: 110%;
2213
}
2314
2415
h2 + p {
25-
margin: 3rem 0 2rem;
16+
max-width: 700px;
17+
margin: 3rem auto 2rem;
2618
}
2719
2820
.btn {
2921
margin-bottom: 5rem;
22+
padding-left: 1.5rem;
23+
24+
span {
25+
display: flex;
26+
align-items: center;
27+
}
28+
29+
img {
30+
width: 4rem;
31+
margin-right: 2.5rem;
32+
}
3033
}
3134
`
3235

33-
const Difference = () => {
34-
const [browser, setBrowser] = useState()
36+
interface DifferenceProps {
37+
title?: string
38+
spacing?: 'small'
39+
}
40+
41+
const Difference = ({title, spacing}: DifferenceProps) => {
42+
const [browser, setBrowser] = useState<any>()
43+
44+
const getBrowserString = (browser: any) => {
45+
if ( browser === 'Firefox') {
46+
return 'Firefox'
47+
}
48+
return 'Chrome'
49+
}
3550

3651
useEffect(() => {
37-
setBrowser(getBrowser(window.navigator.userAgent))
52+
let usersBrowser = getBrowser(window.navigator.userAgent)
53+
setBrowser(getBrowserString(usersBrowser))
3854
})
3955

4056
return (
41-
<StyledDifference className="pattern-bg">
57+
<StyledDifference className="pattern-bg" spacing={spacing}>
4258
<div className="row">
4359
<h2>
44-
<strong>Want to See the Difference for Yourself?</strong>
60+
<strong>{title ? title : 'Want to See the Difference for Yourself?'}</strong>
4561
</h2>
46-
<p>Add a Gitpod button to your repository.</p>
62+
<p>Install the browser extension which adds a Gitpod button to your GitLab, GitHub and Bitbucket projects to easily spin up a dev environment with a single click.</p>
4763
<a
4864
href={
4965
browser === 'Firefox'
@@ -53,7 +69,13 @@ const Difference = () => {
5369
target="_blank"
5470
className="btn btn--big btn--cta"
5571
>
56-
Install Browser Extension
72+
<span>
73+
<img
74+
src={browser === 'Firefox' ? Firefox : Chrome }
75+
alt={browser}
76+
/>
77+
Add to {browser}
78+
</span>
5779
</a>
5880
<p>
5981
Or prefix any GitLab, GitHub or Bitbucket URL with <strong>gitpod.io/#</strong>

src/components/index/GetStarted.tsx

Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,14 @@ import styled from '@emotion/styled'
44
import { sizes } from '../../styles/variables'
55
import { projects } from '../../contents/projects'
66
import Project from './Project'
7-
import PrefixInput from './PrefixInput'
7+
import Difference from '../gitpod-vs-codespaces/Difference'
88

99
const StyledGetStarted = styled.div`
1010
/* ------------------------------------------- */
1111
/* ----- Section Get Started ----- */
1212
/* ------------------------------------------- */
1313
1414
.get-started {
15-
padding-top: 0;
16-
text-align: center;
17-
18-
h3 {
19-
font-weight: 400;
20-
}
21-
22-
&__prefix {
23-
display: flex;
24-
margin-bottom: 12rem;
25-
text-align: left;
26-
}
27-
28-
h2 + p {
29-
font-size: 2rem;
30-
}
31-
32-
/* ----- Projects ----- */
33-
3415
&__projects {
3516
display: flex;
3617
justify-content: space-between;
@@ -55,35 +36,33 @@ const StyledGetStarted = styled.div`
5536
`
5637

5738
const GetStarted = () => (
58-
<StyledGetStarted className="row pattern">
59-
<section className="get-started" id="get-started">
60-
<h2>
61-
<strong>Get Started</strong>
62-
</h2>
63-
<p>
64-
Prefix any GitLab, GitHub, or Bitbucket URL with <strong>gitpod.io/#</strong>
65-
</p>
66-
67-
<div className="get-started__prefix">
68-
<PrefixInput />
69-
</div>
70-
71-
<h3>Or Try an Example Project</h3>
72-
73-
<div className="get-started__projects">
74-
{projects.map((project, i) => (
75-
<Project
76-
key={i}
77-
image={<object role="presentation" tabIndex={-1} data={project.image} />}
78-
title={project.title}
79-
githubUrl={project.githubUrl}
80-
gitlabUrl={project.gitlabUrl}
81-
bitbucketUrl={project.bitbucketUrl}
82-
/>
83-
))}
84-
</div>
39+
<section style={{padding: '0'}}>
40+
<Difference
41+
spacing="small"
42+
title="Get Started"
43+
/>
44+
<section
45+
className="get-started"
46+
id="get-started"
47+
style={{padding: '8rem 0'}}
48+
>
49+
<StyledGetStarted className="row">
50+
<h3 style={{textAlign: 'center', fontWeight: 400}}>Don’t want to open your own repo? Choose an example.</h3>
51+
<div className="get-started__projects">
52+
{projects.map((project, i) => (
53+
<Project
54+
key={i}
55+
image={<object role="presentation" tabIndex={-1} data={project.image} />}
56+
title={project.title}
57+
githubUrl={project.githubUrl}
58+
gitlabUrl={project.gitlabUrl}
59+
bitbucketUrl={project.bitbucketUrl}
60+
/>
61+
))}
62+
</div>
63+
</StyledGetStarted>
64+
</section>
8565
</section>
86-
</StyledGetStarted>
8766
)
8867

8968
export default GetStarted

0 commit comments

Comments
 (0)