Skip to content

Commit

Permalink
Merge pull request #12 from sarkaaa/feat/additional-styles
Browse files Browse the repository at this point in the history
feat: add
  • Loading branch information
sarkaaa authored Apr 4, 2022
2 parents a865cc5 + 32da146 commit 4ca9a97
Show file tree
Hide file tree
Showing 27 changed files with 50,709 additions and 10,285 deletions.
9 changes: 9 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = {
path: `${__dirname}/src/images`,
},
},
`gatsby-plugin-image`,
`gatsby-plugin-lint-queries`,
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
Expand Down Expand Up @@ -68,5 +69,13 @@ module.exports = {
resolve: `gatsby-plugin-create-client-paths`,
options: { prefixes: [`/trasy/*`] },
},
{
resolve: `gatsby-source-instagram-all`,
options: {
access_token: process.env.INSTAGRAM_TOKEN || "",
limit: 10,
pageLimit: 10,
},
},
],
}
49,121 changes: 43,776 additions & 5,345 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"gatsby-image": "^2.3.5",
"gatsby-plugin-create-client-paths": "^4.1.0",
"gatsby-plugin-google-analytics": "^2.2.5",
"gatsby-plugin-image": "^2.11.1",
"gatsby-plugin-lint-queries": "^0.0.3",
"gatsby-plugin-manifest": "^2.3.7",
"gatsby-plugin-offline": "^3.1.5",
Expand All @@ -42,17 +43,20 @@
"gatsby-plugin-styled-components": "^3.2.4",
"gatsby-plugin-typescript": "^2.3.5",
"gatsby-source-filesystem": "^2.2.5",
"gatsby-source-instagram-all": "^5.2.1",
"gatsby-source-strapi": "^1.0.2",
"gatsby-transformer-sharp": "^2.4.7",
"identity-obj-proxy": "^3.0.0",
"isomorphic-fetch": "^3.0.0",
"jest": "^25.4.0",
"polished": "^4.1.3",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-burger-menu": "^2.7.1",
"react-dom": "^16.12.0",
"react-helmet": "^6.0.0",
"react-mapycz": "^1.1.3",
"react-scroll": "^1.8.4",
"react-test-renderer": "^16.13.1",
"styled-components": "^5.1.0",
"typescript": "^3.9.7"
Expand Down
1 change: 1 addition & 0 deletions schema.json

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions src/apollo/wrap-root-element.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from "react"
import fetch from "cross-fetch"
import {
ApolloProvider,
ApolloClient,
InMemoryCache,
HttpLink,
} from "@apollo/client"

const customFetch = (uri, options) => {
return fetch(uri, options).then(response => {
if (response.status >= 500) {
// or handle 400 errors
return Promise.reject(response.status)
}
return response
})
}

const client = new ApolloClient({
link: new HttpLink({
uri: `http://localhost:1337/graphql`,
fetch: customFetch,
}),
cache: new InMemoryCache(),
})

export const wrapRootElement = ({ element }) => (
<ApolloProvider client={client}>{element}</ApolloProvider>
)
174 changes: 143 additions & 31 deletions src/components/button.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,162 @@
import * as React from "react"
import styled, { css } from "styled-components"
import { darken, lighten } from "polished"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faArrowRight } from "@fortawesome/free-solid-svg-icons"

const Button = styled.button<{ secondary?: boolean; small?: boolean }>(
({ theme, small, secondary }) => css`
color: ${theme.colors.light};
const StyledButton = styled.button<{
buttonType?: "primary" | "secondary" | "dark"
small?: boolean
arrowRight?: boolean
}>(
({ theme, small, buttonType = "primary", arrowRight }) => css`
color: ${theme.colors.primary};
font-size: ${theme.sizes.sizeS};
font-family: "Noto Sans", sans-serif;
text-decoration: none;
border-radius: 3rem;
border: solid 2px transparent;
background-image: linear-gradient(
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0)
),
linear-gradient(
-50deg,
${theme.colors.primary},
${theme.colors.terciary},
${theme.colors.secondary}
);
to right,
${buttonType === "secondary" ? theme.colors.red : theme.colors.primary},
${
buttonType === "secondary"
? lighten(0.1, theme.colors.red)
: theme.colors.secondary
}
);
background-origin: border-box;
padding: 0.6rem 2.5rem;
transition: linear 0.2s;
/* padding: 0.6rem 2.5rem; */
padding: 2px;
transition: all linear 0.2s;
cursor: pointer;
position: relative;
height: 60px;
display: flex;
box-sizing: border-box;
${
small &&
css`
padding: 0.45rem 1.25rem;
font-size: ${({ theme }) => theme.sizes.sizeXS};
`
}
${small &&
css`
padding: 0.45rem 1.25rem;
font-size: ${({ theme }) => theme.sizes.sizeXS};
`}
${secondary &&
css`
box-shadow: 2px 10rem 1px ${({ theme }) => theme.colors.light} inset;
color: ${({ theme }) => theme.colors.primary};
`}
&:hover {
& ${Icon} {
background: transparent;
}
&:hover,
&:focus {
box-shadow: none;
color: ${({ theme }) => theme.colors.light};
background-image: linear-gradient(
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0)
),
${theme.colors.primary}, ${theme.colors.secondary};
to right,
${buttonType === "secondary" ? theme.colors.red : theme.colors.primary},
${
buttonType === "secondary"
? lighten(0.1, theme.colors.red)
: theme.colors.secondary
}
);
& ${Icon} {
color: ${theme.colors.light};
background: transparent;
transform: translateX(0.25rem);
}
& span {
background: transparent;
}
}
& span {
background: ${
buttonType === "secondary" ? theme.colors.sand : theme.colors.light
};
border-radius: 3rem;
transition: background 0.5s ease;
box-sizing: border-box;
padding-top: 1.05rem;
padding-left: 1rem;
padding-right: 1rem;
${
arrowRight &&
css`
& {
padding-right: 2.75rem;
}
`
}
}
${
buttonType === "dark" &&
css`
background-image: linear-gradient(
to right,
${theme.colors.light},
${darken(0.05, theme.colors.light)}
);
& span {
color: ${theme.colors.light};
background: ${theme.colors.primary};
}
${Icon} {
color: ${theme.colors.light};
background: transparent;
}
&:hover,
&:focus {
box-shadow: none;
color: ${({ theme }) => theme.colors.light};
background-image: linear-gradient(
to right,
${theme.colors.light},
${darken(0.05, theme.colors.light)}
);
& ${Icon} {
color: ${theme.colors.primary};
}
& span {
color: ${theme.colors.primary};
}
}
`
}
`
)

const Icon = styled(FontAwesomeIcon)(
({ theme }) => css`
position: absolute;
color: ${theme.colors.primary};
margin-left: 0.75rem;
transition: transform ease-in-out 0.2s;
`
)

type Props = {
children: React.ReactNode
arrowRight?: boolean
[x: string]: any
}

const Button = ({ children, arrowRight = false, ...props }: Props) => (
<StyledButton {...props} arrowRight={arrowRight}>
<span>
{children}
{arrowRight && <Icon icon={faArrowRight} />}
</span>
</StyledButton>
)

export default Button
72 changes: 65 additions & 7 deletions src/components/header.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React from "react"
import styled, { css } from "styled-components"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
import { faChevronDown } from "@fortawesome/free-solid-svg-icons"
import { Link as LinkBase } from "react-scroll"
import header from "../images/header.png"

const Wrapper = styled.div<{ homePage?: boolean; customBg?: string }>(
Expand All @@ -15,10 +18,11 @@ const Wrapper = styled.div<{ homePage?: boolean; customBg?: string }>(
background-image: url(${customBg || header});
background-size: cover;
background-position: center;
box-shadow: 0px 5px 13px ${homePage ? "#e0d0b3" : "#c5c5c5"};
z-index: 0;
@media ${theme.sizes.screenWidth.mobile} {
min-height: ${homePage ? "70vh" : "45vh"};
min-height: ${homePage ? "750px" : "370px"};
}
${customBg &&
Expand All @@ -39,14 +43,23 @@ const Wrapper = styled.div<{ homePage?: boolean; customBg?: string }>(
const TitleContainer = styled.div`
position: relative;
max-width: 1240px;
margin-top: 6rem;
margin-top: 8rem;
margin-bottom: 2rem;
padding: 0 1.5rem;
z-index: 2;
`

const Title = styled.h1`
text-align: center;
margin-bottom: 0;
`
const Title = styled.h1<{ small?: boolean }>(
({ theme, small }) => css`
text-align: center;
margin-bottom: 0;
${small &&
css`
font-size: 3rem;
`}
`
)

const Subtitle = styled.h2(
({ theme }) => css`
Expand All @@ -55,6 +68,39 @@ const Subtitle = styled.h2(
`
)

const Link = styled(LinkBase)(
() => css`
&:hover {
cursor: pointer;
}
`
)

const Icon = styled(FontAwesomeIcon)(
({ theme }) => css`
color: ${theme.colors.light};
animation: bounce 2s infinite;
font-size: ${theme.sizes.sizeL};
padding-bottom: 1rem;
@keyframes bounce {
0%,
20%,
50%,
80%,
100% {
transform: translateY(0);
}
40% {
transform: translateY(-1rem);
}
60% {
transform: translateY(-0.5rem);
}
}
`
)

type Props = {
title: string
subtitle?: string
Expand All @@ -64,9 +110,21 @@ type Props = {
const Header = ({ title, subtitle = null, customBg }: Props) => (
<Wrapper customBg={customBg} homePage={window.location.pathname === "/"}>
<TitleContainer>
<Title>{title}</Title>
<Title small={window.location.pathname !== "/"}>{title}</Title>
{subtitle && <Subtitle>{subtitle}</Subtitle>}
</TitleContainer>
{window.location.pathname === "/" && (
<Link
activeClass="active"
className="mainSection"
to="mainSection"
spy={true}
smooth={true}
duration={500}
>
<Icon icon={faChevronDown} />
</Link>
)}
</Wrapper>
)

Expand Down
Loading

0 comments on commit 4ca9a97

Please sign in to comment.