Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: CyberSocYork/cybersoc.co.uk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fc0adc0355e022af1b429f1a516b8309faa52666
Choose a base ref
..
head repository: CyberSocYork/cybersoc.co.uk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 29ecbbd7ca5853b373e38d5adf61c7df84a45c15
Choose a head ref
Showing with 651 additions and 347 deletions.
  1. +30 −0 .eslintrc
  2. +0 −21 .eslintrc.js
  3. 0 gatsby-browser.js → gatsby-browser.tsx
  4. +10 −13 gatsby-config.js → gatsby-config.ts
  5. +3 −3 gatsby-node.js → gatsby-node.ts
  6. +13 −3 package.json
  7. +9 −11 src/components/{Button.js → Button.tsx}
  8. +13 −12 src/components/{Card.js → Card.tsx}
  9. +6 −6 src/components/{CardDeck.js → CardDeck.tsx}
  10. +10 −12 src/components/{CommitteeCard.js → CommitteeCard.tsx}
  11. +0 −49 src/components/EventsDeck.js
  12. +58 −0 src/components/EventsDeck.tsx
  13. +9 −9 src/components/{FadeIn.js → FadeIn.tsx}
  14. +3 −5 src/components/{Footer.js → Footer.tsx}
  15. +13 −15 src/components/{Layout.js → Layout.tsx}
  16. +12 −14 src/components/{NavItem.js → NavItem.tsx}
  17. +7 −9 src/components/{Navbar.js → Navbar.tsx}
  18. +2 −4 src/components/{Particles.js → Particles.tsx}
  19. +16 −10 src/components/{PostLink.js → PostLink.tsx}
  20. +2 −2 src/components/{RegistrationForm.js → RegistrationForm.tsx}
  21. +3 −5 src/components/{Tag.js → Tag.tsx}
  22. +10 −12 src/components/{TextLink.js → TextLink.tsx}
  23. +1 −3 src/components/{committee.js → committee.ts}
  24. +17 −0 src/components/index.tsx
  25. 0 src/content/committee/{history.js → history.ts}
  26. 0 src/content/committee/{roles.js → roles.ts}
  27. +5 −5 src/hooks/useMailchimp.ts
  28. +1 −3 src/pages/{404.js → 404.tsx}
  29. +11 −14 src/pages/{about.js → about.tsx}
  30. +21 −9 src/pages/{blog.js → blog.tsx}
  31. +1 −2 src/pages/{contact.js → contact.tsx}
  32. +2 −5 src/pages/{index.js → index.tsx}
  33. +6 −7 src/pages/{newsletter.js → newsletter.tsx}
  34. 0 src/pages/{redirect.js → redirect.tsx}
  35. +18 −8 src/pages/{resources.js → resources.tsx}
  36. +19 −23 src/pages/{tags.js → tags.tsx}
  37. +20 −13 src/templates/{blogTemplate.js → blogTemplate.tsx}
  38. +28 −30 src/templates/{tags.js → tags.tsx}
  39. +1 −3 src/theme/{GlobalStyles.js → GlobalStyles.ts}
  40. 0 src/theme/{config.js → config.ts}
  41. +107 −0 tsconfig.json
  42. +164 −7 yarn.lock
30 changes: 30 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"env": {
"browser": true,
"es2021": true
},
"plugins": ["react", "@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"rules": {
"indent": ["error", 2],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"react/display-name": 0
},
"settings": {
"react": {
"version": "detect"
}
}
}
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

File renamed without changes.
23 changes: 10 additions & 13 deletions gatsby-config.js → gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -45,18 +45,6 @@ module.exports = {
displayName: true,
},
},
{
resolve: `gatsby-plugin-alias-imports`,
options: {
alias: {
"@components": "src/components",
"@content": "src/content",
"@theme": "src/theme",
"@styles": "src/styles",
"@images": "src/img",
},
},
},
{
resolve: "gatsby-plugin-sitemap",
options: {
@@ -70,7 +58,7 @@ module.exports = {
}
`,
resolveSiteUrl: () => siteUrl,
serialize: ({ path }) => {
serialize: ({ path }: { path: string }) => {
return {
url: path,
};
@@ -87,9 +75,18 @@ module.exports = {
title: String
description: String
datetime: String
location: String
`,
},
},
},
{
resolve: "gatsby-plugin-alias-imports",
options: {
alias: {
"~": "src",
},
},
},
],
};
6 changes: 3 additions & 3 deletions gatsby-node.js → gatsby-node.ts
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@ const kebabCase = require("lodash/kebabCase");
exports.createPages = async ({ actions, graphql }) => {
const { createPage } = actions;

const blogPostTemplate = path.resolve("src/templates/blogTemplate.js");
const tagTemplate = path.resolve("src/templates/tags.js");
const blogPostTemplate = path.resolve("src/templates/blogTemplate.tsx");
const tagTemplate = path.resolve("src/templates/tags.tsx");

const result = await graphql(`
{
@@ -67,7 +67,7 @@ exports.createPages = async ({ actions, graphql }) => {

// Create copies of the newsletter signup page at different URLs.
const registrationPages = ["email", "register"];
const registrationTemplate = path.resolve("src/pages/newsletter.js");
const registrationTemplate = path.resolve("src/pages/newsletter.tsx");

registrationPages.forEach((slug) => {
createPage({
16 changes: 13 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -7,21 +7,24 @@
"scripts": {
"build": "gatsby build",
"develop": "gatsby develop",
"format": "prettier --write \"**/*.{js,jsx,json,md,css,scss}\"",
"format": "prettier --write \"**/*.{ts,tsx,json,md,css,scss}\"",
"start": "yarn run develop",
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1",
"deploy": "gatsby build && gh-pages -d public -b master",
"lint": "eslint \"src/**/*.{js,jsx,json}\"",
"lint": "eslint \"src/**/*.{ts,tsx,json}\"",
"prepare": "husky install"
},
"lint-staged": {
"*.{js,jsx}": "eslint"
},
"dependencies": {
"@fontsource/cabin": "^4.5.0",
"@types/jsonp": "^0.2.1",
"@types/react": "^18.0.9",
"@types/react-helmet": "^6.1.5",
"@types/styled-components": "^5.1.25",
"babel-plugin-styled-components": "^1.13.2",
"date-fns": "^2.23.0",
"fs": "^0.0.1-security",
@@ -56,12 +59,19 @@
"webpack": "^5.51.2"
},
"devDependencies": {
"@types/node": "^17.0.36",
"@types/react-dom": "^18.0.5",
"@types/react-html-parser": "^2.0.2",
"@types/sanitize-html": "^2.6.2",
"@typescript-eslint/eslint-plugin": "^5.26.0",
"@typescript-eslint/parser": "^5.26.0",
"eslint": "^8.16.0",
"eslint-plugin-react": "^7.25.1",
"husky": "^8.0.1",
"lint-staged": "^12.4.2",
"prettier": "^2.3.0",
"pretty-quick": "^3.1.1"
"pretty-quick": "^3.1.1",
"typescript": "^4.7.2"
},
"repository": {
"type": "git",
20 changes: 9 additions & 11 deletions src/components/Button.js → src/components/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import { Link } from "gatsby";
import PropTypes from "prop-types";

import styled from "styled-components";

import { color } from "@theme/config";
import { color } from "~/theme/config";

const StyledButton = styled(Link)`
background-image: linear-gradient(
@@ -31,7 +31,13 @@ const StyledButton = styled(Link)`
}
`;

const Button = ({ to, children, className }) => {
type ButtonProps = {
className?: string;
to: string;
children: React.ReactNode;
};

export const Button = ({ to, children, className }: ButtonProps) => {
// Test whether the link is internal (i.e. starts with a slash).
const isInternal = /^\/(?!\/)/.test(to);

@@ -53,11 +59,3 @@ const Button = ({ to, children, className }) => {
export const SmallButton = styled(Button)`
padding: 0.3em 1em;
`;

Button.propTypes = {
className: PropTypes.string,
to: PropTypes.string.isRequired,
children: PropTypes.node.isRequired,
};

export default Button;
25 changes: 13 additions & 12 deletions src/components/Card.js → src/components/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import ReactHtmlParser from "react-html-parser";
import sanitizeHtml from "sanitize-html";
import PropTypes from "prop-types";

import styled from "styled-components";

import { color } from "@theme/config";
import { color } from "~/theme/config";

import cardImg from "@images/card_img.jpg";
import cardImg from "~/img/card_img.jpg";

const StyledCard = styled.div`
background-color: ${color.secondary};
@@ -42,7 +42,16 @@ const Image = styled.img`
object-position: center;
`;

const Card = ({ title = "Title", detail, desc }) => (
type CardProps = {
title: string;
detail: string;
desc: string;
style: {
[key: string]: string;
};
};

export const Card = ({ title = "Title", detail, desc }: CardProps) => (
<StyledCard>
<Image src={cardImg} alt="CyberSoc members and the society banner" />
<Body>
@@ -52,11 +61,3 @@ const Card = ({ title = "Title", detail, desc }) => (
</Body>
</StyledCard>
);

Card.propTypes = {
title: PropTypes.string,
detail: PropTypes.string,
desc: PropTypes.string,
};

export default Card;
12 changes: 6 additions & 6 deletions src/components/CardDeck.js → src/components/CardDeck.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import PropTypes from "prop-types";

import styled from "styled-components";

const StyledCardDeck = styled.div`
@@ -12,10 +12,10 @@ const StyledCardDeck = styled.div`
grid-auto-rows: auto;
`;

const CardDeck = ({ children }) => <StyledCardDeck>{children}</StyledCardDeck>;

CardDeck.propTypes = {
children: PropTypes.node,
type CardDeckProps = {
children: React.ReactNode;
};

export default CardDeck;
export const CardDeck = ({ children }: CardDeckProps) => (
<StyledCardDeck>{children}</StyledCardDeck>
);
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import PropTypes from "prop-types";

import styled from "styled-components";

import { color } from "@theme/config";
import { color } from "~/theme/config";

const StyledCard = styled.div`
text-align: center;
@@ -31,20 +31,18 @@ const Role = styled.h3`

const Description = styled.p``;

const CommitteeCard = ({ name, role, desc, image }) => (
type CommitteeCardProps = {
name: string;
role: string;
desc?: string;
image?: string;
};

export const CommitteeCard = ({ name, role, desc, image }: CommitteeCardProps) => (
<StyledCard>
<Image alt={`Committee member ${name}`} src={image || "/committee-photos/placeholder.png"} />
<Name>{name}</Name>
<Role>{role}</Role>
<Description>{desc || ""}</Description>
</StyledCard>
);

CommitteeCard.propTypes = {
name: PropTypes.string.isRequired,
role: PropTypes.string.isRequired,
desc: PropTypes.string,
image: PropTypes.string,
};

export default CommitteeCard;
49 changes: 0 additions & 49 deletions src/components/EventsDeck.js

This file was deleted.

Loading