Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tslint #2

Merged
merged 1 commit into from
Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"trailingComma": "es5",
"bracketSpacing": true,
"singleQuote": false
}
14 changes: 12 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
"dependencies": {
"@emotion/core": "^10.0.27",
"@emotion/styled": "^10.0.15",
"@fortawesome/fontawesome": "^1.1.8",
"@fortawesome/fontawesome-common-types": "^0.2.21",
"@fortawesome/fontawesome-svg-core": "^1.2.26",
"@fortawesome/free-brands-svg-icons": "^5.12.0",
"@fortawesome/free-regular-svg-icons": "^5.12.0",
"@fortawesome/free-solid-svg-icons": "^5.12.0",
"@fortawesome/react-fontawesome": "^0.1.8",
"@mdx-js/loader": "^1.3.0",
Expand Down Expand Up @@ -52,10 +54,18 @@
"@storybook/addons": "^5.1.10",
"@storybook/react": "^5.3.3",
"@types/storybook__react": "^4.0.2",
"babel-loader": "^8.0.6"
"babel-loader": "^8.0.6",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"tslint-react": "^4.1.0",
"tslint-react-hooks": "^2.2.1",
"typescript": "^3.7.4"
},
"scripts": {
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
"build-storybook": "build-storybook",
"tslint": "tslint -p tsconfig.json -c tslint.json",
"tslint-fix": "tslint --fix -p tsconfig.json -c tslint.json",
"tslint-check": "tslint-config-prettier-check tslint.json"
}
}
2 changes: 1 addition & 1 deletion src/components/Banner/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { jsx, Box } from "theme-ui";
import { Box, jsx } from "theme-ui";

export interface BannerProps {
backgroundImageUrl: string;
Expand Down
4 changes: 2 additions & 2 deletions src/components/DefaultHead/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export const DefaultHead = ({ siteYaml, children }: HeadProps) => {
const { name, streetAddress, city, latitude, longitude } = location

const seo = {
title: title,
description: description,
title,
description,
url: siteUrl,
image: defaultImage
};
Expand Down
2 changes: 1 addition & 1 deletion src/components/EventCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx jsx */
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Box, Flex, jsx, Styled } from "theme-ui";
import SiteYamlType from "../../types/siteYaml";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
// import { MDXRenderer } from "gatsby-plugin-mdx";

export interface EventCardProps {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx jsx */
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { Box, Flex, jsx, Styled } from "theme-ui";
import SiteYamlType from "../../types/siteYaml";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";

import { IconButton } from "../buttons/index";
import { SocialIcon } from "../SocialIcon";
Expand Down
2 changes: 1 addition & 1 deletion src/components/FooterLinkGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { jsx, Box, Flex, Styled } from "theme-ui";
import { Box, Flex, jsx, Styled } from "theme-ui";

export const FooterComplete = () => (
<FooterLinkGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Head/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { ReactNode } from "react";
import Helmet from "react-helmet";
import SiteYamlType from "../../types/siteYaml";
import FrontmatterType from "../../types/frontmatter";
import SiteYamlType from "../../types/siteYaml";

export interface HeadProps {
siteYaml: SiteYamlType;
Expand Down
77 changes: 32 additions & 45 deletions src/components/HeaderNav/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { useState, useEffect } from "react";
import { jsx, Box, Flex, Styled } from "theme-ui";
import { useEffect, useState } from "react";
import { Box, Flex, jsx, Styled } from "theme-ui";
import SiteYamlType from "../../types/siteYaml";
import { Logo } from "../Logo";

Expand All @@ -18,24 +18,17 @@ export interface HeaderNavProps {
page: string;
}

export const HeaderNav = ({
togglePageFix,
siteYaml,
logo,
page
}: HeaderNavProps) => {
export const HeaderNav = ({ togglePageFix, siteYaml, logo, page }: HeaderNavProps) => {
const { title, headerNav } = siteYaml;

const [headerBg, setHeaderBg] = useState("headerTransparent");

useEffect(() => {
window.addEventListener("scroll", function() {
let currentOffset = window.pageYOffset;
let windowWidth = window.innerWidth;
let breakPoint = windowWidth > 800 ? 200 : 100;
setHeaderBg(
currentOffset > breakPoint ? "headerOpaque" : "headerTransparent"
);
window.addEventListener("scroll", () => {
const currentOffset = window.pageYOffset;
const windowWidth = window.innerWidth;
const breakPoint = windowWidth > 800 ? 200 : 100;
setHeaderBg(currentOffset > breakPoint ? "headerOpaque" : "headerTransparent");
});
});

Expand All @@ -45,15 +38,15 @@ export const HeaderNav = ({
backgroundColor: page === "home" ? headerBg : "headerOpaque",
transition: ".6s",
paddingX: [4, 4, 5],
paddingY: 3
paddingY: 3,
}}
>
<BurgerNav
togglePageFix={togglePageFix}
title={title}
links={headerNav.map(link => ({
description: link.description,
href: link.href
href: link.href,
}))}
logo={logo}
page={page}
Expand All @@ -64,7 +57,7 @@ export const HeaderNav = ({
logo={logo}
links={headerNav.map(link => ({
description: link.description,
href: link.href
href: link.href,
}))}
/>
</Box>
Expand All @@ -85,7 +78,7 @@ const Navbar = ({ links, title, logo, page }: NavbarProps) => {
sx={{
justifyContent: "space-between",
alignItems: "center",
paddingY: 3
paddingY: 3,
}}
>
<Styled.a href="/">
Expand All @@ -98,22 +91,22 @@ const Navbar = ({ links, title, logo, page }: NavbarProps) => {
css={{
a: {
opacity: 0.8,
transition: ".4s"
transition: ".4s",
},
"&:hover > a": {
opacity: 1
opacity: 1,
},
"&:hover > a:not(:hover)": {
opacity: ".5"
}
opacity: ".5",
},
}}
>
{links.map((link: LinkProps, i: number) => (
<Styled.a
key={i}
href={link.href}
sx={{
textDecoration: "none"
textDecoration: "none",
}}
>
<HeaderLink>{link.description.toUpperCase()}</HeaderLink>
Expand All @@ -135,10 +128,10 @@ const HeaderLogo = ({ children, logo, page }: HeaderLogoProps) => {
const [smallHeadingOpacity, setHeadingOpacity] = useState(0);

useEffect(() => {
window.addEventListener("scroll", function() {
let currentOffset = window.pageYOffset;
let windowWidth = window.innerWidth;
let breakPoint = windowWidth > 800 ? 500 : 100;
window.addEventListener("scroll", () => {
const currentOffset = window.pageYOffset;
const windowWidth = window.innerWidth;
const breakPoint = windowWidth > 800 ? 500 : 100;
setHeadingOpacity(currentOffset > breakPoint ? 1 : 0);
});
});
Expand All @@ -160,7 +153,7 @@ const HeaderLogo = ({ children, logo, page }: HeaderLogoProps) => {
display: "inline-block",
verticalAlign: "super",
marginLeft: "20px",
transition: ".6s opacity"
transition: ".6s opacity",
}}
>
{children}
Expand All @@ -183,7 +176,7 @@ const HeaderLink = ({ children }: ChildrenProps) => (
marginX: [4, 4, 5],
letterSpacing: [0, 0, "1px"],
fontWeight: "light",
font: "modern"
font: "modern",
}}
>
{children}
Expand All @@ -195,7 +188,7 @@ const BurgerLink = ({ children }: ChildrenProps) => (
sx={{
variant: "borderStyles.veryLightBorderTop",
width: "100%",
padding: 4
padding: 4,
}}
>
<Styled.p
Expand All @@ -210,8 +203,8 @@ const BurgerLink = ({ children }: ChildrenProps) => (
"&:hover": {
color: "background",
backgroundColor: "elixirLight",
variant: "boxShadowStyles.mediumShadow"
}
variant: "boxShadowStyles.mediumShadow",
},
}}
>
{children}
Expand All @@ -227,7 +220,7 @@ const IconBar = () => (
marginY: "6px",
backgroundColor: "background",
opacity: 0.8,
borderRadius: 4
borderRadius: 4,
}}
/>
);
Expand All @@ -252,13 +245,7 @@ interface BurgerNavProps {
page: string;
}

const BurgerNav = ({
links,
title,
togglePageFix,
logo,
page
}: BurgerNavProps) => {
const BurgerNav = ({ links, title, togglePageFix, logo, page }: BurgerNavProps) => {
const [value, setValue] = useState("none");

const dropDownOnClick = () => {
Expand All @@ -278,7 +265,7 @@ const BurgerNav = ({
sx={{
justifyContent: "space-between",
alignItems: "center",
paddingY: 3
paddingY: 3,
}}
>
<Styled.a href="/">
Expand All @@ -298,15 +285,15 @@ const BurgerNav = ({
variant: "textStyles.modern",
fontSize: 3,
zIndex: 25,
left: 0
left: 0,
}}
>
<Flex
sx={{
width: "100%",
flexDirection: "column",
textAlign: "center",
zIndex: 5
zIndex: 5,
}}
>
{links.map((link, i) => (
Expand All @@ -326,7 +313,7 @@ const BurgerNav = ({
width: "100%",
height: "100%",
backgroundColor: "darkness",
opacity: "0.2"
opacity: "0.2",
}}
/>
</Box>
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeroEvent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @jsx jsx */
import { Box, Flex, jsx, Styled } from "theme-ui";
import { IconButton } from "../buttons/index";
import SiteYamlType from "../../types/siteYaml";
import { IconButton } from "../buttons/index";

import { Logo } from "../Logo";

Expand Down
2 changes: 1 addition & 1 deletion src/components/MapDescription/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { Box, Flex, jsx, Styled, Container } from "theme-ui";
import { Box, Container, Flex, jsx, Styled } from "theme-ui";
import { Map } from "../Map";

export interface MapDescriptionProps {
Expand Down
4 changes: 2 additions & 2 deletions src/components/NextEvent/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @jsx jsx */
import { jsx, Container, Flex, Styled } from "theme-ui";
import { MDXRenderer } from "gatsby-plugin-mdx";
import { Container, Flex, jsx, Styled } from "theme-ui";

export interface NextEventProps {
siteYaml: any;
Expand Down Expand Up @@ -45,7 +45,7 @@ export const NextEvent = ({
margin: 1,
fontWeight: "normal"
}}
></Styled.h4>
/>
<Styled.h3
sx={{
margin: 1,
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrganisersRow/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @jsx jsx */
import { jsx, Box, Flex, Styled, Container } from "theme-ui";
import { Box, Container, Flex, jsx, Styled } from "theme-ui";

import { Avatar } from "../Avatar";

Expand Down
14 changes: 5 additions & 9 deletions src/components/PageInformation/index.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
/** @jsx jsx */
import { Box, Flex, jsx, Styled } from "theme-ui";
import { Container } from "theme-ui";
import { Box, Container, Flex, jsx, Styled } from "theme-ui";

export interface PageInformationProps {
heading1: string;
paragraph1: string;
}

export const PageInformation = ({
heading1,
paragraph1
}: PageInformationProps) => {
export const PageInformation = ({ heading1, paragraph1 }: PageInformationProps) => {
return (
<Container sx={{ display: "flex", justifyContent: "center" }}>
<Box sx={{ width: "100%", marginTop: [5, 0, 0] }}>
<Heading>{heading1}</Heading>
<Flex
sx={{
width: "100%",
flexDirection: ["column", "row", "row"]
flexDirection: ["column", "row", "row"],
}}
>
<Paragraph>{paragraph1}</Paragraph>
Expand All @@ -40,7 +36,7 @@ const Paragraph = ({ children }: ChildrenProps) => (
flexDirection: "column",
fontFamily: "body",
marginX: [0, 0, 90],
marginBottom: 40
marginBottom: 40,
}}
>
{children}
Expand All @@ -56,7 +52,7 @@ const Heading = ({ children }: ChildrenProps) => (
variant: "textStyles.heading",
marginY: 50,
fontFamily: "body",
fontWeight: "normal"
fontWeight: "normal",
}}
>
{children}
Expand Down
Loading