add urls to links in navbar, add smooth scroll

This commit is contained in:
Dawid Wysokiński 2020-07-14 14:38:07 +02:00
parent aa9cb1de0a
commit 302a0a858c
19 changed files with 207 additions and 128 deletions

103
README.md
View File

@ -1,99 +1,8 @@
<!-- AUTO-GENERATED-CONTENT:START (STARTER) -->
<p align="center">
<a href="https://www.gatsbyjs.org">
<img alt="Gatsby" src="https://www.gatsbyjs.org/monogram.svg" width="60" />
</a>
</p>
<h1 align="center">
Gatsby's default starter
</h1>
# dawid-wysokinski.pl
Kick off your project with this default boilerplate. This starter ships with the main Gatsby configuration files you might need to get up and running blazing fast with the blazing fast app generator for React.
## How to run locally
_Have another more specific idea? You may want to check out our vibrant collection of [official and community-created starters](https://www.gatsbyjs.org/docs/gatsby-starters/)._
## 🚀 Quick start
1. **Create a Gatsby site.**
Use the Gatsby CLI to create a new site, specifying the default starter.
```shell
# create a new Gatsby site using the default starter
gatsby new my-default-starter https://github.com/gatsbyjs/gatsby-starter-default
```
1. **Start developing.**
Navigate into your new sites directory and start it up.
```shell
cd my-default-starter/
gatsby develop
```
1. **Open the source code and start editing!**
Your site is now running at `http://localhost:8000`!
_Note: You'll also see a second link: _`http://localhost:8000/___graphql`_. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the [Gatsby tutorial](https://www.gatsbyjs.org/tutorial/part-five/#introducing-graphiql)._
Open the `my-default-starter` directory in your code editor of choice and edit `src/pages/index.js`. Save your changes and the browser will update in real time!
## 🧐 What's inside?
A quick look at the top-level files and directories you'll see in a Gatsby project.
.
├── node_modules
├── src
├── .gitignore
├── .prettierrc
├── gatsby-browser.js
├── gatsby-config.js
├── gatsby-node.js
├── gatsby-ssr.js
├── LICENSE
├── package-lock.json
├── package.json
└── README.md
1. **`/node_modules`**: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed.
2. **`/src`**: This directory will contain all of the code related to what you will see on the front-end of your site (what you see in the browser) such as your site header or a page template. `src` is a convention for “source code”.
3. **`.gitignore`**: This file tells git which files it should not track / not maintain a version history for.
4. **`.prettierrc`**: This is a configuration file for [Prettier](https://prettier.io/). Prettier is a tool to help keep the formatting of your code consistent.
5. **`gatsby-browser.js`**: This file is where Gatsby expects to find any usage of the [Gatsby browser APIs](https://www.gatsbyjs.org/docs/browser-apis/) (if any). These allow customization/extension of default Gatsby settings affecting the browser.
6. **`gatsby-config.js`**: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins youd like to include, etc. (Check out the [config docs](https://www.gatsbyjs.org/docs/gatsby-config/) for more detail).
7. **`gatsby-node.js`**: This file is where Gatsby expects to find any usage of the [Gatsby Node APIs](https://www.gatsbyjs.org/docs/node-apis/) (if any). These allow customization/extension of default Gatsby settings affecting pieces of the site build process.
8. **`gatsby-ssr.js`**: This file is where Gatsby expects to find any usage of the [Gatsby server-side rendering APIs](https://www.gatsbyjs.org/docs/ssr-apis/) (if any). These allow customization of default Gatsby settings affecting server-side rendering.
9. **`LICENSE`**: This Gatsby starter is licensed under the 0BSD license. This means that you can see this file as a placeholder and replace it with your own license.
10. **`package-lock.json`** (See `package.json` below, first). This is an automatically generated file based on the exact versions of your npm dependencies that were installed for your project. **(You wont change this file directly).**
11. **`package.json`**: A manifest file for Node.js projects, which includes things like metadata (the projects name, author, etc). This manifest is how npm knows which packages to install for your project.
12. **`README.md`**: A text file containing useful reference information about your project.
## 🎓 Learning Gatsby
Looking for more guidance? Full documentation for Gatsby lives [on the website](https://www.gatsbyjs.org/). Here are some places to start:
- **For most developers, we recommend starting with our [in-depth tutorial for creating a site with Gatsby](https://www.gatsbyjs.org/tutorial/).** It starts with zero assumptions about your level of ability and walks through every step of the process.
- **To dive straight into code samples, head [to our documentation](https://www.gatsbyjs.org/docs/).** In particular, check out the _Guides_, _API Reference_, and _Advanced Tutorials_ sections in the sidebar.
## 💫 Deploy
[![Deploy to Netlify](https://www.netlify.com/img/deploy/button.svg)](https://app.netlify.com/start/deploy?repository=https://github.com/gatsbyjs/gatsby-starter-default)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/import/project?template=https://github.com/gatsbyjs/gatsby-starter-default)
<!-- AUTO-GENERATED-CONTENT:END -->
1. Clone repo.
2. Navigate to the right directory.
3. yarn install
4. yarn develop

View File

@ -12,6 +12,7 @@
"babel-plugin-transform-imports": "^2.0.0",
"classnames": "^2.2.6",
"gatsby": "^2.23.12",
"gatsby-background-image": "^1.1.1",
"gatsby-image": "^2.4.9",
"gatsby-plugin-manifest": "^2.4.14",
"gatsby-plugin-offline": "^3.2.13",

View File

@ -1,7 +1,11 @@
import React, { useState } from "react"
import classnames from "classnames"
import * as routes from "@config/routes"
import useSmoothScroll from "@libs/useSmoothScroll"
import logo from "@images/logo.svg"
import { HEADER_ID } from "@features/HomePage/components/Header"
import { SECTION_ID as PROJECTS_SECTION_ID } from "@features/HomePage/components/Projects/Projects"
import { SECTION_ID as CONTACT_SECTION_ID } from "@features/HomePage/components/Contact"
import { makeStyles } from "@material-ui/core/styles"
import {
@ -11,9 +15,10 @@ import {
Hidden,
Menu,
MenuItem,
Link,
} from "@material-ui/core"
import { Menu as MenuIcon } from "@material-ui/icons"
import { Link, IconButton } from "gatsby-theme-material-ui"
import { Link as GatsbyLink, IconButton } from "gatsby-theme-material-ui"
const useStyles = makeStyles(theme => ({
appBar: {
@ -55,6 +60,7 @@ const useStyles = makeStyles(theme => ({
function Navbar({ className, ...rest }) {
const [anchorEl, setAnchorEl] = useState(null)
const classes = useStyles()
const handleLinkClick = useSmoothScroll()
const open = Boolean(anchorEl)
const handleMenuOpen = event => {
@ -75,19 +81,37 @@ function Navbar({ className, ...rest }) {
<Container>
<Toolbar className={classes.toolbar} disableGutters>
<div className={classes.titleContainer}>
<Link title="Strona główna" color="inherit" to={routes.HOME}>
<GatsbyLink title="Strona główna" color="inherit" to={routes.HOME}>
<img className={classes.logo} src={logo} alt="logo" />
</Link>
</GatsbyLink>
</div>
<div className={classes.divider} />
<div>
<Hidden implementation="css" xsDown className={classes.hidden}>
<Link title="Strona główna" color="inherit" to={routes.HOME}>
Strona główna
<Link
title="Start"
color="inherit"
href={"#" + HEADER_ID}
onClick={handleLinkClick(HEADER_ID)}
>
Start
</Link>
<Link title="Projekty" color="inherit" to={routes.PROJECTS}>
<Link
title="Projekty"
color="inherit"
href={"#" + PROJECTS_SECTION_ID}
onClick={handleLinkClick(PROJECTS_SECTION_ID)}
>
Projekty
</Link>
<Link
title="Kontakt"
color="inherit"
href={"#" + CONTACT_SECTION_ID}
onClick={handleLinkClick(CONTACT_SECTION_ID)}
>
Kontakt
</Link>
</Hidden>
<Hidden implementation="css" smUp>
<IconButton
@ -115,13 +139,14 @@ function Navbar({ className, ...rest }) {
>
<MenuItem>
<Link
title="Strona główna"
title="Start"
color="inherit"
underline="none"
className={classes.link}
to={routes.HOME}
href={"#" + HEADER_ID}
onClick={handleLinkClick(HEADER_ID)}
>
Strona główna
Start
</Link>
</MenuItem>
<MenuItem>
@ -130,11 +155,24 @@ function Navbar({ className, ...rest }) {
color="inherit"
underline="none"
className={classes.link}
to={routes.PROJECTS}
href={"#" + PROJECTS_SECTION_ID}
onClick={handleLinkClick(PROJECTS_SECTION_ID)}
>
Projekty
</Link>
</MenuItem>
<MenuItem>
<Link
title="Kontakt"
color="inherit"
underline="none"
className={classes.link}
href={"#" + CONTACT_SECTION_ID}
onClick={handleLinkClick(CONTACT_SECTION_ID)}
>
Kontakt
</Link>
</MenuItem>
</Menu>
</Hidden>
</div>

View File

@ -34,7 +34,7 @@ export const SIZE = {
MEDIUM: "medium",
}
function Section({ children, className, bgColor, component, size }) {
function Section({ children, className, bgColor, component, size, ...rest }) {
const classes = useStyles()
const Component = component || "section"
return (
@ -44,6 +44,7 @@ function Section({ children, className, bgColor, component, size }) {
"is-black": bgColor === BG_COLOR.BLACK,
"is-small": size === SIZE.SMALL,
})}
{...rest}
>
{children}
</Component>

View File

@ -1,2 +1 @@
export const HOME = "/"
export const PROJECTS = "/"

View File

@ -11,13 +11,9 @@ import Section from "@components/Section"
const useStyles = makeStyles(theme => {
return {
container: {
textAlign: "center",
},
typography: {
display: "flex",
alignItems: "center",
justifyContent: "center",
wordBreak: "break-all",
"& > *:not(:last-child)": {
marginRight: theme.spacing(1),
@ -31,6 +27,8 @@ const useStyles = makeStyles(theme => {
}
})
export const SECTION_ID = "contact"
function Contact() {
const classes = useStyles()
@ -40,13 +38,15 @@ function Contact() {
}
return (
<Section size="small">
<Container maxWidth="md" className={classes.container}>
<Section size="small" id={SECTION_ID}>
<Container maxWidth="md">
<Grid container alignItems="center" spacing={1}>
<Grid item xs={12} sm={5}>
<Typography variant="h2">Kontakt</Typography>
<Grid item xs={12} sm={6}>
<Typography align="center" variant="h2">
Kontakt
</Typography>
</Grid>
<Grid item xs={12} sm={7}>
<Grid item xs={12} sm={6}>
<div className={classes.contactUrls}>
<Typography className={classes.typography} variant="h6">
<EmailIcon fontSize="large" />

View File

@ -1,7 +1,9 @@
import React from "react"
import useSmoothScroll from "@libs/useSmoothScroll"
import { SECTION_ID } from "./Contact"
import { makeStyles } from "@material-ui/core/styles"
import { Container, Typography, Button } from "@material-ui/core"
import { Container, Typography, Button, Link } from "@material-ui/core"
import bg from "./header-bg.jpg"
const useStyles = makeStyles(theme => ({
@ -35,10 +37,13 @@ const useStyles = makeStyles(theme => ({
},
}))
export const HEADER_ID = "start"
function Header() {
const classes = useStyles()
const handleLinkClick = useSmoothScroll()
return (
<header className={classes.header}>
<header id={HEADER_ID} className={classes.header}>
<Container className={classes.container}>
<div>
<div className={classes.textContainer}>
@ -52,9 +57,15 @@ function Header() {
Masz projekt, pomysł lub problem, który chcesz ze mną omówić?
</Typography>
</div>
<Button variant="outlined" size="large">
<Typography variant="h4">Skontaktuj się</Typography>
</Button>
<Link
underline="none"
to={"#" + SECTION_ID}
onClick={handleLinkClick(SECTION_ID)}
>
<Button variant="outlined" size="large">
<Typography variant="h4">Skontaktuj się</Typography>
</Button>
</Link>
</div>
</Container>
</header>

View File

@ -13,6 +13,7 @@ import {
Chip,
Link,
} from "@material-ui/core"
import BackgroundImage from "gatsby-background-image"
const useStyles = makeStyles(theme => ({
card: {
@ -79,6 +80,7 @@ function Project({
github,
live,
img,
fluid,
}) {
const classes = useStyles()
return (
@ -87,7 +89,15 @@ function Project({
reverse,
})}
>
<CardMedia image={img} title={title} className={classes.cover} />
{fluid ? (
<BackgroundImage
fluid={fluid}
title={title}
className={classes.cover}
/>
) : (
<CardMedia image={img} title={title} className={classes.cover} />
)}
<CardContent className={classes.cardContent}>
<div className={classes.contentContainer}>
<Typography variant="h3" gutterBottom>

View File

@ -1,4 +1,5 @@
import React from "react"
import { useStaticQuery, graphql } from "gatsby"
import { makeStyles } from "@material-ui/core/styles"
import { Typography, Container } from "@material-ui/core"
@ -24,20 +25,56 @@ const useStyles = makeStyles(theme => ({
},
}))
export const SECTION_ID = "projects"
function Projects() {
const classes = useStyles()
const data = useStaticQuery(graphql`
{
allCoverImages: allFile(
filter: { absolutePath: { regex: "/projects/" } }
) {
edges {
node {
relativePath
childImageSharp {
id
fluid(maxWidth: 1000) {
...GatsbyImageSharpFluid
}
}
}
}
}
}
`)
return (
<Section className={classes.section} bgColor={BG_COLOR.PRIMARY}>
<Section
id={SECTION_ID}
className={classes.section}
bgColor={BG_COLOR.PRIMARY}
>
<Container>
<Typography variant="h2" align="center" gutterBottom>
Projekty
</Typography>
<div className={classes.projects}>
{projects.map((project, index) => {
let fluid = undefined
if (project.fluid) {
const edge = data.allCoverImages.edges.find(
img => img.node.relativePath === project.fluid
)
if (edge) {
fluid = edge.node.childImageSharp.fluid
}
}
return (
<Project
key={project.title}
{...project}
fluid={fluid}
reverse={(index + 1) % 2 === 0}
/>
)
@ -85,6 +122,7 @@ const projects = [
"React Native",
],
github: "",
fluid: "projects/zdam.png",
live: "https://zdamegzaminzawodowy.pl/",
},
{
@ -93,6 +131,7 @@ const projects = [
technologies: ["React", "Next.JS", "Bulma", "Ghost"],
github: "https://github.com/Kichiyaki/matura-z-informatyki.pl",
live: "https://matura-z-informatyki.pl/",
fluid: "projects/maturazinf.png",
},
{
title: "dawid-wysokinski.pl",
@ -100,12 +139,28 @@ const projects = [
technologies: ["React", "Gatsby", "Material-UI"],
github: "https://github.com/Kichiyaki/dawid-wysokinski.pl",
live: "https://dawid-wysokinski.pl",
fluid: "projects/dw.png",
},
{
title: "tribalbooster.pl",
description: "",
technologies: ["React", "Gatsby", "Material-UI"],
live: "http://tribalbooster.pl/",
fluid: "projects/tribalbooster.png",
},
{
title: "OLX Crawler",
description:
"Program służący do automatycznego przeglądania ogłoszeń na portalu olx.",
technologies: [
"React",
"Material-UI",
"Golang",
"Colly",
"SQLite3",
"Echo",
],
github: "https://github.com/Kichiyaki/olx-crawler",
},
{
title: "Instaling.pl Bot",
@ -125,12 +180,14 @@ const projects = [
description: "",
technologies: ["HTML", "CSS", "Bootstrap"],
live: "https://dawid-wysokinski.pl/podglad/akademia/",
fluid: "projects/amz.png",
},
{
title: "Freshline",
description: "",
technologies: ["Wordpress", "CSS", "Bootstrap"],
live: "http://fresh-line.pl/",
fluid: "projects/freshline.png",
},
]

BIN
src/images/projects/amz.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

BIN
src/images/projects/dw.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 365 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -0,0 +1,14 @@
import isSmoothScrollSupported from "@utils/isSmoothScrollSupported"
export default () => {
return id => e => {
if (isSmoothScrollSupported()) {
e.preventDefault()
document.querySelector("#" + id).scrollIntoView({
behavior: "smooth",
block: "start",
inline: "nearest",
})
}
}
}

View File

@ -23,7 +23,7 @@ const NotFoundPage = ({ location }) => {
const classes = useStyles()
return (
<Layout className={classes.layout} showHeader={false} showFooter={false}>
<Layout className={classes.layout} showNavbar={false} showFooter={false}>
<SEO
title="Strona nie została znaleziona"
description="Strona nie została znaleziona"

View File

@ -0,0 +1 @@
export default () => "scrollBehavior" in document.documentElement.style

View File

@ -939,7 +939,7 @@
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.4"
"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7":
"@babel/runtime@^7.0.0", "@babel/runtime@^7.10.0", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.10.4.tgz#a6724f1a6b8d2f6ea5236dbfe58c7d7ea9c5eb99"
integrity sha512-UpTN5yUJr9b4EX2CnGNWIvER7Ab83ibv0pcvvHc4UOdrBI5jb8bj+32cCwPX6xu0mt2daFNjYhoi+X7beH0RSw==
@ -5696,6 +5696,13 @@ fill-range@^7.0.1:
dependencies:
to-regex-range "^5.0.1"
filter-invalid-dom-props@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/filter-invalid-dom-props/-/filter-invalid-dom-props-2.0.0.tgz#527f1494cb3c4f282a73c43804153eb80c42dc2c"
integrity sha1-Un8UlMs8Tygqc8Q4BBU+uAxC3Cw=
dependencies:
html-attributes "1.1.0"
finalhandler@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/finalhandler/-/finalhandler-1.1.2.tgz#b7e7d000ffd11938d0fdb053506f6ebabe9f587d"
@ -5935,6 +5942,17 @@ functional-red-black-tree@^1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
gatsby-background-image@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/gatsby-background-image/-/gatsby-background-image-1.1.1.tgz#491ae4966fe573d67d34bb04f765b51bbf5f74ed"
integrity sha512-W56ETGF6zz35JlXZPmRq0HWuuYQ2wFFDC/DDHyRWuZ/uRSwpg9ZTOHiTW9EQI5Si9FSfD8U5ePnW+do/ToZPtA==
dependencies:
"@babel/runtime" "^7.9.2"
filter-invalid-dom-props "^2.0.0"
global "^4.4.0"
short-uuid "^3.1.1"
sort-media-queries "^0.2.2"
gatsby-cli@^2.12.52:
version "2.12.52"
resolved "https://registry.yarnpkg.com/gatsby-cli/-/gatsby-cli-2.12.52.tgz#127a8e6cf0802289ad3a233c52ca8aa23c0dc73b"
@ -6644,7 +6662,7 @@ global-prefix@^1.0.1:
is-windows "^1.0.1"
which "^1.2.14"
global@^4.3.0:
global@^4.3.0, global@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406"
integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==
@ -7142,6 +7160,11 @@ hsla-regex@^1.0.0:
resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38"
integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg=
html-attributes@1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/html-attributes/-/html-attributes-1.1.0.tgz#82027a4fac7a6070ea6c18cc3886aea18d6dea09"
integrity sha1-ggJ6T6x6YHDqbBjMOIauoY1t6gk=
html-comment-regex@^1.1.0:
version "1.1.2"
resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.2.tgz#97d4688aeb5c81886a364faa0cad1dda14d433a7"
@ -12087,6 +12110,14 @@ shell-quote@1.6.1:
array-reduce "~0.0.0"
jsonify "~0.0.0"
short-uuid@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/short-uuid/-/short-uuid-3.1.1.tgz#3ff427074b5fa7822c3793994d18a7a82e2f73a4"
integrity sha512-7dI69xtJYpTIbg44R6JSgrbDtZFuZ9vAwwmnF/L0PinykbFrhQ7V8omKsQcVw1TP0nYJ7uQp1PN6/aVMkzQFGQ==
dependencies:
any-base "^1.1.0"
uuid "^3.3.2"
side-channel@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.2.tgz#df5d1abadb4e4bf4af1cd8852bf132d2f7876947"
@ -12322,6 +12353,13 @@ sort-keys@^2.0.0:
dependencies:
is-plain-obj "^1.0.0"
sort-media-queries@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/sort-media-queries/-/sort-media-queries-0.2.2.tgz#fddfc1e70d662759091b6a23776f4488683dca1e"
integrity sha1-/d/B5w1mJ1kJG2ojd29EiGg9yh4=
dependencies:
xtend "^4.0.0"
source-list-map@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/source-list-map/-/source-list-map-2.0.1.tgz#3993bd873bfc48479cca9ea3a547835c7c154b34"