Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 96af3d6

Browse files
committed
switch github button to css module
1 parent c11d7b2 commit 96af3d6

File tree

7 files changed

+71
-65
lines changed

7 files changed

+71
-65
lines changed

src/components/buttons/GithubButton.tsx

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import React from "react";
2+
import { FaGithub } from "react-icons/all";
3+
import { useHistory } from "react-router-dom";
4+
import styles from "./styles.module.scss";
5+
6+
export type Props = { to: string };
7+
8+
const GithubButton: React.FC<Props> = (props) => {
9+
const { to } = props;
10+
const history = useHistory();
11+
12+
return (
13+
<button
14+
className={styles.buttonContainer}
15+
onClick={() => {
16+
if (to.startsWith("http")) {
17+
window.location.href = to;
18+
return;
19+
}
20+
history.push(to);
21+
}}
22+
{...props}
23+
>
24+
<FaGithub className={styles.githubIcon} />
25+
<div>GITHUB</div>
26+
</button>
27+
);
28+
};
29+
30+
export default GithubButton;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
.buttonContainer {
2+
color: var(--ifm-color-on-surface);
3+
background-color: var(--ifm-color-surface);
4+
5+
border-radius: 3px;
6+
border: none;
7+
8+
font-size: 18px;
9+
font-weight: bold;
10+
11+
cursor: pointer;
12+
13+
display: flex;
14+
flex-direction: row;
15+
align-items: center;
16+
justify-content: center;
17+
padding: 15px 30px;
18+
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.3);
19+
20+
transition: 0.3s ease all;
21+
22+
&:hover {
23+
background-color: var(--ifm-color-surface-2);
24+
}
25+
26+
.githubIcon {
27+
margin-right: 5px;
28+
}
29+
}

src/components/buttons/PrimaryButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const PrimaryButton: React.FC<Props> = (props) => {
2727
export default PrimaryButton;
2828

2929
const Button = styled.button`
30-
color: ${(props) => props.theme.colors?.on_primary};
31-
background-color: ${(props) => props.theme.colors?.primary};
30+
color: var(--ifm-color-on-primary);
31+
background-color: var(--ifm-color-primary);
3232
border-radius: 3px;
3333
border: none;
3434
@@ -44,6 +44,6 @@ const Button = styled.button`
4444
transition: 0.3s ease all;
4545
4646
&:hover {
47-
background-color: ${(props) => props.theme.colors?.primary_2};
47+
background-color: var(--ifm-color-primary-lighter);
4848
}
4949
`;

src/css/custom.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
// Theme Colors
4040
// ==============================================================================
4141

42+
// Primary
43+
// See 'General Docusaurs'
44+
--ifm-color-on-primary: var(--ifm-color-white);
45+
4246
// Background
4347
--ifm-color-background: var(--ifm-color-white);
4448
--ifm-color-background-2: var(--ifm-color-white-dark);
@@ -333,6 +337,10 @@ html[data-theme='dark'] {
333337
// Theme Colors
334338
// ==============================================================================
335339

340+
// Primary
341+
// See 'General Docusaurs'
342+
--ifm-color-on-primary: var(--ifm-color-black);
343+
336344
// Background
337345
--ifm-color-background: var(--ifm-color-black);
338346
--ifm-color-background-2: var(--ifm-color-black-light);

src/pages/LandingPage/components/HeaderView/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react";
22
import styled from "styled-components";
33
import PrimaryButton from "../../../../components/buttons/PrimaryButton";
4-
import GithubButton from "../../../../components/buttons/GithubButton";
54
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
65
import HeaderTyper from "../../../../components/HeaderTyper";
76
import Spacer from "../../../../components/Spacer";
7+
import GithubButton from "../../../../components/buttons/GithubButton";
88

99
const HeaderView: React.FC = () => {
1010
const { siteConfig } = useDocusaurusContext();

src/pages/LandingPage/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import Layout from "@theme/Layout";
66
import "react-toastify/dist/ReactToastify.css";
77
import HeaderView from "./components/HeaderView";
88
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
9-
import GiveItATryView from "./components/GiveItATriyView";
10-
import Spacer from "../../components/Spacer";
119

1210
const LandingPage: React.FC = () => {
1311
const windowSize = useWindowSize();

0 commit comments

Comments
 (0)