Skip to content

Commit 0f7b7f4

Browse files
MaxIsJoecorp-0
authored andcommitted
feat: separate dowload button from socials buttons and add icon prop to buttons
1 parent c3ef1cc commit 0f7b7f4

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

components/button.tsx

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
1+
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
2+
import { IconDefinition } from '@fortawesome/fontawesome-common-types';
3+
14
type ButtonProps = {
2-
filled: boolean, text: string, linkTo: string
5+
filled: boolean, text: string, linkTo: string, buttonIcon?: IconDefinition,
36
}
47

58

69
const Button = (props: ButtonProps) => {
7-
const {filled, text, linkTo} = props;
10+
const {filled, text, linkTo, buttonIcon} = props;
811
const filledClass = 'bg-gray-800 border-2 border-transparent text-white text-md mr-4 hover:bg-gray-900';
912
const outlineClass = 'bg-transparent border-2 border-gray-800 text-white text-md hover:bg-gray-800';
1013

1114
return (
1215

1316
<a href={linkTo}
14-
className={`uppercase py-2 px-4 ${filled ? filledClass : outlineClass}` }>
15-
{text}
17+
className={`uppercase py-2 px-4 flex justify-center items-center ${filled ? filledClass : outlineClass}` }>
18+
{ShowIcon(buttonIcon)}
19+
<div>
20+
{text}
21+
</div>
1622
</a>
1723
)
1824

1925
};
2026

27+
function ShowIcon(buttonIcon? : IconDefinition)
28+
{
29+
if(buttonIcon != null)
30+
{
31+
return <div className="pr-2">
32+
<FontAwesomeIcon icon={buttonIcon}></FontAwesomeIcon>
33+
</div>
34+
}
35+
return '';
36+
}
37+
2138
export default Button;

components/landing/landingButtons.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,30 @@ import getDownloadLink from '../../lib/platform';
33
const githubUrl = 'https://github.com/unitystation/unitystation';
44
const discordInviteUrl = 'https://discord.com/invite/tFcTpBp';
55
const githubReleases = 'https://github.com/unitystation/stationhub/releases/latest';
6+
const patreonUrl = 'https://www.patreon.com/unitystation';
7+
import { faCloudDownload } from '@fortawesome/free-solid-svg-icons';
68

79
import {useEffect, useState} from 'react';
810

911

10-
1112
const LandingButtons = () => {
1213
const [downloadLink, setDownloadLink] = useState(githubReleases);
1314

1415
useEffect(() => {
1516
getDownloadLink().then((link) => setDownloadLink(link));
1617
}, []);
1718

18-
return (<div className={'flex flex-wrap justify-center mt-8 gap-4'}>
19-
<Button filled={true} text={'Download'} linkTo={downloadLink}/>
20-
<Button filled={false} text={'Github'} linkTo={githubUrl}/>
21-
<Button filled={false} text={'Discord'} linkTo={discordInviteUrl}/>
22-
</div>)
19+
return (
20+
<>
21+
<div className={'flex flex-wrap justify-center mt-8 gap-4'}>
22+
<Button filled={true} text={'Download'} linkTo={downloadLink} buttonIcon={faCloudDownload}/>
23+
</div>
24+
<div className={'flex flex-wrap justify-center mt-8 gap-4'}>
25+
<Button filled={false} text={'Github'} linkTo={githubUrl}/>
26+
<Button filled={false} text={'Discord'} linkTo={discordInviteUrl}/>
27+
<Button filled={false} text={'Patreon'} linkTo={patreonUrl}/>
28+
</div>
29+
</>)
2330
}
2431

2532
export default LandingButtons;

0 commit comments

Comments
 (0)