Skip to content

Commit bde2b60

Browse files
authored
Enhance homepage (#459)
* Upgrade Tailwind and refactor opening section * Update remaining visible sections * Use docusaurus logo and apply minor fix * Add helper function for adding utm params and update css * Cleanup * Add description and nav icon dimension * Convert image to webp * Fix error
1 parent e3cec5b commit bde2b60

17 files changed

+503
-398
lines changed

docusaurus.config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ const config = {
114114
alt: 'GameCI Logo',
115115
src: 'assets/images/game-ci-brand-logo-wordmark-light.svg',
116116
srcDark: 'assets/images/game-ci-brand-logo-wordmark.svg',
117+
width: 32,
118+
height: 32,
117119
},
118120
items: [
119121
{
@@ -277,8 +279,8 @@ const config = {
277279
],
278280
copyright: `<p>
279281
Made with ❤ by open source contributors using
280-
<a href="https://docusaurus.io" target="_blank" rel="noreferrer noopener">
281-
<span aria-label="Docusaurus">🦖</span>
282+
<a href="https://docusaurus.io?utm_source=game-ci" target="_blank" rel="noreferrer noopener" style="text-decoration: none;">
283+
<svg title=""Docusaurus width="1em" viewBox="0 0 256 217.631"><g transform="matrix(1.312821 0 0 1.312821 -3.938461 -22.614974)" fill-rule="evenodd"><path d="M99 52h84v34H99z" fill="#fff"/><g fill="#3ecc5f"><path d="M23 163c-7.398 0-13.843-4.027-17.303-10C3.992 155.944 3 159.353 3 163c0 11.046 8.954 20 20 20h20v-20H23z"/><path d="M112.98 57.376L183 53V43c0-11.046-8.955-20-20-20H73l-2.5-4.33a2.89 2.89 0 0 0-5 0L63 23l-2.5-4.33a2.89 2.89 0 0 0-5 0L53 23l-2.5-4.33a2.89 2.89 0 0 0-5 0L43 23c-.022 0-.043.003-.065.003l-4.142-4.14a2.89 2.89 0 0 0-4.829 1.294l-1.368 5.104-5.193-1.392a2.89 2.89 0 0 0-3.535 3.536l1.4 5.193-5.103 1.367a2.89 2.89 0 0 0-1.295 4.83L23 42.937c0 .02-.002.042-.002.064l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 53l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 63l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 73l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 83l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 93l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 103l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 113l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 123l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 133l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 143l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 153l-4.33 2.5a2.89 2.89 0 0 0 0 5L23 163c0 11.046 8.954 20 20 20h120c11.045 0 20-8.954 20-20V83l-70.02-4.376C107.37 78.273 103 73.62 103 68s4.37-10.273 9.98-10.624"/><path d="M143 183h30v-40h-30z"/></g><path d="M193 158c-.22 0-.428.037-.64.064l-.116-.45c1.806-.754 3.075-2.534 3.075-4.613a5 5 0 0 0-5-5 4.96 4.96 0 0 0-3.016 1.036l-.335-.336c.627-.836 1-1.862 1-2.987a5 5 0 0 0-9.599-1.959l-.445-.115c.027-.2.064-.42.064-.64a5 5 0 1 0-10 0c0 .22.037.428.064.64l-.445.115a5 5 0 0 0-9.599 1.959c0 1.125.384 2.15 1 2.987A19.93 19.93 0 0 0 153 163c0 11.046 8.954 20 20 20 9.34 0 17.16-6.4 19.36-15.064.2.027.42.064.64.064a5 5 0 1 0 0-10" fill="#44d860"/><path d="M153 123h30v-20h-30z" fill="#3ecc5f"/><use xlink:href="#A" fill="#44d860"/><path d="M63 55.5a2.5 2.5 0 0 1-2.5-2.5 7.51 7.51 0 0 0-7.5-7.5 7.51 7.51 0 0 0-7.5 7.5 2.5 2.5 0 1 1-5 0c0-6.893 5.607-12.5 12.5-12.5S65.5 46.107 65.5 53a2.5 2.5 0 0 1-2.5 2.5"/><path d="M103 183h60c11.046 0 20-8.954 20-20V93h-60c-11.046 0-20 8.954-20 20v70z" fill="#ffff50"/><use xlink:href="#B"/><use xlink:href="#B" y="20"/><use xlink:href="#B" y="40"/><use xlink:href="#B" y="-9.814"/><use xlink:href="#B" y="10"/><use xlink:href="#B" y="30"/><path d="M183 61.6c-.012 0-.022-.006-.034-.005-3.1.105-4.552 3.196-5.842 5.923-1.346 2.85-2.387 4.703-4.093 4.647-1.9-.068-2.97-2.202-4.113-4.46-1.314-2.593-2.814-5.535-5.963-5.425-3.046.104-4.513 2.794-5.807 5.167-1.377 2.528-2.314 4.065-4.12 3.994-1.927-.07-2.95-1.805-4.136-3.813-1.32-2.236-2.848-4.75-5.936-4.664-2.994.103-4.465 2.385-5.763 4.4-1.373 2.13-2.335 3.428-4.165 3.35-1.973-.07-2.992-1.5-4.17-3.177-1.324-1.873-2.816-3.993-5.895-3.9-2.928.1-4.4 1.97-5.696 3.618-1.232 1.564-2.194 2.802-4.23 2.724a1 1 0 1 0-.072 2c3.017.1 4.545-1.8 5.872-3.487 1.177-1.496 2.193-2.787 4.193-2.855 1.926-.082 2.83 1.115 4.195 3.045 1.297 1.834 2.77 3.914 5.73 4.02 3.103.104 4.596-2.215 5.918-4.267 1.182-1.834 2.202-3.417 4.15-3.484 1.793-.067 2.77 1.35 4.145 3.68 1.297 2.197 2.766 4.686 5.787 4.796 3.125.108 4.634-2.62 5.95-5.035 1.14-2.088 2.214-4.06 4.12-4.126 1.793-.042 2.728 1.595 4.1 4.33 1.292 2.553 2.757 5.445 5.825 5.556l.17.003c3.064 0 4.518-3.075 5.805-5.794 1.14-2.4 2.217-4.68 4.067-4.773v-2z"/><path d="M83 183h40v-40H83z" fill="#3ecc5f"/><path d="M143 158c-.22 0-.428.037-.64.064l-.116-.45c1.806-.754 3.075-2.534 3.075-4.613a5 5 0 0 0-5-5 4.96 4.96 0 0 0-3.016 1.036l-.335-.336c.627-.836 1-1.862 1-2.987a5 5 0 0 0-9.599-1.959l-.445-.115c.027-.2.064-.42.064-.64a5 5 0 1 0-10 0c0 .22.037.428.064.64l-.445.115a5 5 0 0 0-9.599 1.959c0 1.125.384 2.15 1 2.987A19.93 19.93 0 0 0 103 163c0 11.046 8.954 20 20 20 9.34 0 17.16-6.4 19.36-15.064.2.027.42.064.64.064a5 5 0 1 0 0-10" fill="#44d860"/><path d="M83 123h40v-20H83z" fill="#3ecc5f"/><use xlink:href="#A" x="-60" fill="#44d860"/><path d="M143 41.75a2.92 2.92 0 0 1-.5-.05 2.52 2.52 0 0 1-.47-.14c-.15-.06-.3-.14-.43-.23l-.38-.3c-.1-.12-.22-.24-.3-.38a2.63 2.63 0 0 1-.231-.43 2.62 2.62 0 0 1-.139-.47c-.03-.16-.05-.33-.05-.5s.02-.33.05-.5.08-.3.14-.47a2.63 2.63 0 0 1 .231-.43l.3-.38c.12-.1.25-.22.38-.3a1.99 1.99 0 0 1 .43-.23 2.52 2.52 0 0 1 .47-.14c.32-.07.65-.07.98 0 .16.03.32.08.47.14s.3.14.43.23l.38.3a3.68 3.68 0 0 1 .31.38 2.55 2.55 0 0 1 .23.43c.06.16.1.3.14.47a2.81 2.81 0 0 1 .05.49 2.55 2.55 0 0 1-.73 1.77c-.12.1-.25.22-.38.3a1.99 1.99 0 0 1-.43.23c-.15.06-.3.1-.47.14a2.07 2.07 0 0 1-.5.05M163 40.5a2.55 2.55 0 0 1-1.77-.73 3.68 3.68 0 0 1-.31-.38 2.63 2.63 0 0 1-.231-.43 2.62 2.62 0 0 1-.139-.47c-.03-.16-.05-.33-.05-.5a2.55 2.55 0 0 1 .73-1.77c.12-.1.25-.22.38-.3a1.99 1.99 0 0 1 .43-.23 2.52 2.52 0 0 1 .47-.14c.32-.07.66-.07.98 0 .16.03.32.08.47.14s.3.14.43.23l.38.3a2.53 2.53 0 0 1 .73 1.77 2.81 2.81 0 0 1-.05.49c-.03.16-.08.32-.14.47a3.55 3.55 0 0 1-.23.43 3.68 3.68 0 0 1-.31.38c-.12.1-.25.22-.38.3a1.99 1.99 0 0 1-.43.23c-.15.06-.3.1-.47.14a2.07 2.07 0 0 1-.5.05"/></g><defs><path id="A" d="M193 115.5a2.5 2.5 0 1 0 0-5c-.1 0-.214.02-.32.032l-.058-.225a2.5 2.5 0 0 0-.963-4.807 2.47 2.47 0 0 0-1.508.518l-.168-.168a2.47 2.47 0 0 0 .506-1.494 2.5 2.5 0 0 0-4.8-.979c-.857-.24-1.756-.377-2.7-.377-5.522 0-10 4.478-10 10s4.478 10 10 10c.934 0 1.833-.138 2.7-.377a2.5 2.5 0 0 0 4.8-.979c0-.563-.192-1.077-.506-1.494.057-.055.113-.1.168-.168a2.48 2.48 0 0 0 1.508.518 2.5 2.5 0 0 0 .963-4.807l.058-.225c.105.013.2.032.32.032"/><path id="B" d="M168.02 124h-50.04a1 1 0 1 1 0-2h50.04a1 1 0 1 1 0 2"/></defs></svg>
282284
</a>
283285
and hosted by
284286
<a href="https://firebase.com?utm_source=game-ci" target="_blank" rel="noreferrer noopener">

src/components/pages/home/section/getting-started.tsx

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,56 @@
11
import Link from '@docusaurus/Link';
2-
import React from 'react';
3-
import cx from 'classnames';
4-
import styles from '@site/src/components/pages/home/section/section.module.scss';
5-
import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view';
2+
import React, { SVGProps, ComponentType } from 'react';
63
import GitHubLogo from '@site/static/assets/images/icons/github.svg';
74
import GitLabLogo from '@site/static/assets/images/icons/gitlab.svg';
85
import CircleCiLogo from '@site/static/assets/images/icons/circleci.svg';
96

7+
const list = [
8+
{
9+
name: 'github',
10+
logo: GitHubLogo,
11+
url: '/docs/github/getting-started',
12+
},
13+
{
14+
name: 'gitlab',
15+
logo: GitLabLogo,
16+
url: '/docs/gitlab/getting-started',
17+
},
18+
{
19+
name: 'circleci',
20+
logo: CircleCiLogo,
21+
url: '/docs/circleci/getting-started',
22+
},
23+
];
24+
25+
type LinkButtonProps = {
26+
url: string;
27+
logo: ComponentType<SVGProps<SVGSVGElement>>;
28+
};
29+
30+
const LinkButton = ({ url, logo: Logo }: LinkButtonProps) => (
31+
<Link
32+
to={url}
33+
className="group flex items-center justify-center border-gray-600 border-solid rounded-sm border-2 px-6 py-3 w-[200px] h-[70px] transition-all duration-200 hover:scale-110 hover:bg-gray-600"
34+
>
35+
<Logo className="fill-brand-text-light dark:fill-brand-text-dark group-hover:fill-white" />
36+
</Link>
37+
);
38+
1039
const GettingStarted = () => {
1140
return (
12-
<span className={styles.gettingStartedSection}>
13-
<FadeIntoView>
14-
<h2 className={cx('text-center font-bold mb-4', styles.subtitle)}>Get Started Using:</h2>
15-
</FadeIntoView>
41+
<>
42+
<h2 className="text-center font-bold mb-4 text-3xl md:text-6xl text-primary-light dark:text-primary-dark">
43+
Get Started Using:
44+
</h2>
1645

17-
<FadeIntoView className={styles.gettingStartedLinks}>
18-
<div className="w-full mt-6 inline-flex gap-10 flex-col md:flex-row items-center justify-center pb-16">
19-
<Link to="/docs/github/getting-started" className={styles.button}>
20-
<GitHubLogo />
21-
</Link>
22-
<Link to="/docs/gitlab/getting-started" className={styles.button}>
23-
<GitLabLogo />
24-
</Link>
25-
<Link to="/docs/circleci/getting-started" className={styles.button}>
26-
<CircleCiLogo />
27-
</Link>
28-
</div>
29-
</FadeIntoView>
30-
</span>
46+
<ul className="list-none px-0 w-full mt-6 inline-flex gap-10 flex-col md:flex-row items-center justify-center pb-16">
47+
{list.map(({ url, name, logo }) => (
48+
<li key={name}>
49+
<LinkButton url={url} logo={logo} />
50+
</li>
51+
))}
52+
</ul>
53+
</>
3154
);
3255
};
3356

src/components/pages/home/section/opening-section.tsx

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,46 @@
11
import React, { createRef } from 'react';
2-
import cx from 'classnames';
3-
import { useColorMode } from '@docusaurus/theme-common';
42
import GameCiLogo from '@site/static/assets/images/game-ci-brand-logo-wordmark.svg';
53
import GameCiLogoLight from '@site/static/assets/images/game-ci-brand-logo-wordmark-light.svg';
64
import Section from '@site/src/components/pages/home/section/section';
75
import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view';
8-
import styles from './section.module.scss';
96
import GettingStarted from './getting-started';
107

118
const OpeningSection = () => {
129
const ref = createRef<HTMLDivElement>();
1310

14-
const { colorMode } = useColorMode();
15-
const isDarkTheme = colorMode === 'dark';
16-
const Logo = isDarkTheme ? GameCiLogo : GameCiLogoLight;
17-
1811
const scrollToNextSection = () => {
1912
const element = ref.current.getBoundingClientRect();
2013
window.scrollTo({ top: element.height, behavior: 'smooth' });
2114
};
2215

2316
return (
24-
<Section ref={ref} className={styles.openingSection}>
17+
<Section ref={ref} className="!py-0 !px-4 !min-h-[calc(100vh-60px)]">
2518
<FadeIntoView>
26-
<Logo className={styles.logo} />
19+
<h1>
20+
<span className="invisible absolute w-0 h-0">GameCI</span>
21+
<GameCiLogoLight className="block dark:hidden select-none w-full max-w-[320px] h-auto" />
22+
<GameCiLogo className="hidden dark:block select-none w-full max-w-[320px] h-auto" />
23+
</h1>
2724
</FadeIntoView>
2825

2926
<FadeIntoView delay={150}>
30-
<h1 className={cx('text-sm md:text-2xl', styles.title)}>
27+
<h2 className="text-base md:text-2xl text-center w-full max-w-[500px]">
3128
The fastest and <strong>easiest</strong> way to automatically test and build your game
3229
projects
33-
</h1>
30+
</h2>
3431
</FadeIntoView>
3532

36-
<GettingStarted />
33+
<FadeIntoView delay={200}>
34+
<div className="mt-8 md:mt-12">
35+
<GettingStarted />
36+
</div>
37+
</FadeIntoView>
3738

3839
<button
3940
type="button"
4041
onClick={scrollToNextSection}
41-
className="hidden md:block"
42-
style={{
43-
fontSize: '7vmin',
44-
background: 'none',
45-
border: 'none',
46-
cursor: 'pointer',
47-
position: 'absolute',
48-
bottom: '0',
49-
left: '50%',
50-
transform: 'translateX(-50%)',
51-
}}
42+
className="hidden md:block bg-transparent border-none cursor-pointer text-7xl absolute bottom-0 mb-2 focus-visible:outline focus-visible:outline-2"
43+
aria-label="Click to scroll to the next section"
5244
>
5345
5446
</button>

src/components/pages/home/section/pricing-section.tsx

Lines changed: 88 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import React, { useState } from 'react';
2-
import cx from 'classnames';
1+
import React, { ComponentType, MouseEventHandler, SVGProps, useState } from 'react';
32
import { SiGitlab, SiGithub, SiCircleci } from 'react-icons/si';
4-
import { useColorMode } from '@docusaurus/theme-common';
53
import Section from '@site/src/components/pages/home/section/section';
6-
import styles from './section.module.scss';
4+
import FadeIntoView from '@site/src/components/molecules/animations/fade-into-view';
75

86
const currencyToSymbol = (currency: string) => {
97
switch (currency) {
@@ -27,81 +25,100 @@ const currencyToSymbol = (currency: string) => {
2725
}
2826
};
2927

28+
const list = [
29+
{
30+
name: 'github',
31+
logo: SiGithub,
32+
},
33+
{
34+
name: 'gitlab',
35+
logo: SiGitlab,
36+
},
37+
{
38+
name: 'circleci',
39+
logo: SiCircleci,
40+
},
41+
];
42+
43+
type ButtonProps = {
44+
name: string;
45+
isSelected: boolean;
46+
onClick: MouseEventHandler<HTMLButtonElement>;
47+
logo: ComponentType<SVGProps<SVGSVGElement>>;
48+
};
49+
50+
const Button = ({ name, onClick, isSelected, logo: Logo }: ButtonProps) => {
51+
const isSelectedClassNames = isSelected
52+
? '!border-primary-light !dark:border-primary-dark border-4'
53+
: '';
54+
55+
return (
56+
<button
57+
onClick={onClick}
58+
className={`rounded-md p-1 mx-1 aspect-square w-11 h-11 transition-all duration-300 cursor-pointer bg-transparent border border-solid border-secondary-light dark:border-secondary-dark ${isSelectedClassNames}`}
59+
type="button"
60+
>
61+
<Logo className="w-5 h-5" aria-label={name} />
62+
</button>
63+
);
64+
};
65+
3066
const PricingSection = () => {
3167
const [minutes, setMinutes] = useState(0);
3268
const [currency, setCurrency] = useState('EUR');
33-
const [selectedVsc, setVsc] = useState(0);
34-
const { colorMode } = useColorMode();
35-
const isDarkTheme = colorMode === 'dark';
36-
37-
const backgroundClassName = isDarkTheme ? 'bg-black' : 'bg-white';
38-
const totalPriceBackgroundClassName = isDarkTheme ? 'bg-gray-800' : 'bg-gray-200';
69+
const [selectedVsc, setVsc] = useState('github');
3970

4071
return (
41-
<Section className={styles.pricingSection}>
42-
<h2 className={cx('text-center text-5xl font-bold mb-10', styles.title)}>
43-
Pricing calculator
44-
</h2>
45-
46-
<div className="p-3 rounded-md flex gap-3 h-52">
47-
<div className={`${backgroundClassName} p-3 rounded-md flex flex-col justify-between`}>
48-
<div>
49-
<button
50-
onClick={() => setVsc(0)}
51-
className={`${styles.vscButton} ${selectedVsc === 0 && styles.selected}`}
52-
type="button"
53-
>
54-
<SiGithub />
55-
</button>
56-
<button
57-
onClick={() => setVsc(1)}
58-
className={`${styles.vscButton} ${selectedVsc === 1 && styles.selected}`}
59-
type="button"
60-
>
61-
<SiGitlab />
62-
</button>
63-
<button
64-
onClick={() => setVsc(2)}
65-
className={`${styles.vscButton} ${selectedVsc === 2 && styles.selected}`}
66-
type="button"
67-
>
68-
<SiCircleci />
69-
</button>
70-
<br />
71-
</div>
72-
<label htmlFor="minutes">
73-
<h4>Minutes:</h4>
74-
<div className="flex items-center gap-1">
75-
<input
76-
id="minutes"
77-
min={0}
78-
max={1000}
79-
defaultValue={0}
80-
type="range"
81-
onChange={(event) => {
82-
setMinutes(Number.parseInt(event.target.value, 10));
83-
}}
84-
/>
85-
<span className="w-8">{minutes <= 999 ? minutes : <>&infin;</>}</span>
72+
<Section title="Pricing calculator">
73+
<FadeIntoView>
74+
<div className="p-3 rounded-md flex gap-3 h-52 bg-primary-light dark:bg-primary-dark">
75+
<div className="bg-white dark:bg-black p-3 rounded-md flex flex-col justify-between">
76+
<div>
77+
{list.map(({ name, logo }) => (
78+
<Button
79+
key={name}
80+
name={name}
81+
isSelected={selectedVsc === name}
82+
logo={logo}
83+
onClick={() => setVsc(name)}
84+
/>
85+
))}
8686
</div>
87-
</label>
88-
</div>
87+
<label htmlFor="minutes">
88+
<p className="font-bold">Minutes:</p>
89+
<div className="flex items-center gap-1">
90+
<input
91+
name="minutes"
92+
min={0}
93+
max={1000}
94+
defaultValue={0}
95+
type="range"
96+
step={10}
97+
onChange={(event) => {
98+
setMinutes(Number.parseInt(event.target.value, 10));
99+
}}
100+
/>
101+
<span className="w-8">{minutes === 1000 ? <>&infin;</> : minutes}</span>
102+
</div>
103+
</label>
104+
</div>
89105

90-
<div className={`${backgroundClassName} p-3 rounded-md flex flex-col justify-between`}>
91-
<select onChange={(event) => setCurrency(event.target.value)}>
92-
<option value="EUR">EUR &euro;</option>
93-
<option value="USD">USD $</option>
94-
<option value="ILS">ILS &#x20aa;</option>
95-
<option value="CAD">CAD $</option>
96-
<option value="AUD">AUD $</option>
97-
<option value="RUB">RUB &#x20bd;</option>
98-
<option value="JYP">JYP &yen;</option>
99-
</select>
100-
<span className={`${totalPriceBackgroundClassName} p-2 rounded-sm`}>
101-
<h5 className="m-0 text-center">0.00 {currencyToSymbol(currency)}</h5>
102-
</span>
106+
<div className="bg-white dark:bg-black p-3 rounded-md flex flex-col justify-between">
107+
<select onChange={(event) => setCurrency(event.target.value)} aria-label="currency">
108+
<option value="EUR">EUR &euro;</option>
109+
<option value="USD">USD $</option>
110+
<option value="ILS">ILS &#x20aa;</option>
111+
<option value="CAD">CAD $</option>
112+
<option value="AUD">AUD $</option>
113+
<option value="RUB">RUB &#x20bd;</option>
114+
<option value="JYP">JYP &yen;</option>
115+
</select>
116+
<span className="bg-gray-200 dark:bg-gray-800 p-2 rounded-sm">
117+
<p className="m-0 text-center font-bold">0.00 {currencyToSymbol(currency)}</p>
118+
</span>
119+
</div>
103120
</div>
104-
</div>
121+
</FadeIntoView>
105122
</Section>
106123
);
107124
};

0 commit comments

Comments
 (0)