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

Commit c1d1e4c

Browse files
authored
Merge pull request #65 from chicio/particles-home-background
New home background 🚀
2 parents 4753031 + 0d0b942 commit c1d1e4c

File tree

46 files changed

+197
-449
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+197
-449
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Change Log
22
All changes to Chicio coding will be documented in this file.
33

4+
## [4.4.0](https://github.com/chicio/chicio.github.io/releases/tag/v4.4.0)
5+
Release date: 2021-04-29
6+
7+
#### Added
8+
9+
- New home background with tsParticle
10+
- Added adaptive loading dependency
11+
- Added device detect dependency
12+
413
## [4.3.0](https://github.com/chicio/chicio.github.io/releases/tag/v4.3.0)
514
Release date: 2021-04-29
615

__stories__/molecules/post-tags.stories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Template: Story<PostTagsProps> = (args) => <PostTags {...args} />;
99

1010
export const PostTagsStory = Template.bind({});
1111
PostTagsStory.args = {
12-
tags: ["iOS", "macOS", "mobile app development"],
12+
tags: ["ios", "macos", "mobile app development"],
1313
};
1414
PostTagsStory.storyName = "Post Tags";
1515

graphql-types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ export type DirectoryCtimeArgs = {
258258
export type Site = Node & {
259259
buildTime?: Maybe<Scalars['Date']>;
260260
siteMetadata?: Maybe<SiteSiteMetadata>;
261+
port?: Maybe<Scalars['Int']>;
262+
host?: Maybe<Scalars['String']>;
261263
polyfill?: Maybe<Scalars['Boolean']>;
262264
pathPrefix?: Maybe<Scalars['String']>;
263265
id: Scalars['ID'];
@@ -1009,6 +1011,8 @@ export type QueryAllDirectoryArgs = {
10091011
export type QuerySiteArgs = {
10101012
buildTime?: Maybe<DateQueryOperatorInput>;
10111013
siteMetadata?: Maybe<SiteSiteMetadataFilterInput>;
1014+
port?: Maybe<IntQueryOperatorInput>;
1015+
host?: Maybe<StringQueryOperatorInput>;
10121016
polyfill?: Maybe<BooleanQueryOperatorInput>;
10131017
pathPrefix?: Maybe<StringQueryOperatorInput>;
10141018
id?: Maybe<StringQueryOperatorInput>;
@@ -2183,6 +2187,8 @@ export type SiteFieldsEnum =
21832187
| 'siteMetadata___contacts___links___medium'
21842188
| 'siteMetadata___contacts___links___devto'
21852189
| 'siteMetadata___contacts___links___instagram'
2190+
| 'port'
2191+
| 'host'
21862192
| 'polyfill'
21872193
| 'pathPrefix'
21882194
| 'id'
@@ -2284,6 +2290,8 @@ export type SiteGroupConnection = {
22842290
export type SiteFilterInput = {
22852291
buildTime?: Maybe<DateQueryOperatorInput>;
22862292
siteMetadata?: Maybe<SiteSiteMetadataFilterInput>;
2293+
port?: Maybe<IntQueryOperatorInput>;
2294+
host?: Maybe<StringQueryOperatorInput>;
22872295
polyfill?: Maybe<BooleanQueryOperatorInput>;
22882296
pathPrefix?: Maybe<StringQueryOperatorInput>;
22892297
id?: Maybe<StringQueryOperatorInput>;

package-lock.json

Lines changed: 51 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fabrizioduroni.it",
3-
"version": "4.3.0",
3+
"version": "4.4.0",
44
"private": true,
55
"description": "Fabrizio Duroni aka 'chicio' website",
66
"repository": {
@@ -33,18 +33,19 @@
3333
"start": "gatsby develop",
3434
"prebuild": "npm run test",
3535
"build": "gatsby build",
36-
"postbuild": "npm run build-storybook && cp -R ./static/chicio-coding-design-system ./public/",
36+
"postbuild": "npm run build-storybook",
3737
"build-ci": "./scripts/build-ci.sh",
3838
"serve": "gatsby serve",
3939
"clean": "gatsby clean",
4040
"predeploy": "npm run clean && npm run build",
4141
"deploy": "gh-pages -d public -b main",
4242
"storybook": "start-storybook -p 6006",
43-
"build-storybook": "build-storybook -o ./static/chicio-coding-design-system"
43+
"build-storybook": "build-storybook -o ./public/chicio-coding-design-system"
4444
},
4545
"dependencies": {
4646
"@styled-icons/fa-brands": "^10.26.0",
4747
"@styled-icons/fa-solid": "^10.32.0",
48+
"@types/react-adaptive-hooks": "0.0.0",
4849
"@types/styled-components": "^5.1.9",
4950
"babel-plugin-styled-components": "^1.12.0",
5051
"disqus-react": "^1.0.11",
@@ -73,8 +74,11 @@
7374
"katex": "^0.13.0",
7475
"prismjs": "^1.23.0",
7576
"react": "^17.0.1",
77+
"react-adaptive-hooks": "0.0.8",
78+
"react-device-detect": "^1.17.0",
7679
"react-dom": "^17.0.1",
7780
"react-helmet": "^6.1.0",
81+
"react-tsparticles": "^1.26.4",
7882
"sass": "^1.32.8",
7983
"styled-components": "^5.2.3"
8084
},
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import React from "react";
2+
import Particles from "react-tsparticles";
3+
import { textAbovePrimaryColor } from "./theme";
4+
import { isSafariDesktop, useIsPowerfulDesktop } from "../logic/device";
5+
6+
export const BackgroundFullScreen: React.FC = () => {
7+
const isPowerfulDesktop = useIsPowerfulDesktop();
8+
9+
return (
10+
<div>
11+
{(isSafariDesktop() || isPowerfulDesktop) && (
12+
<Particles
13+
id="tsparticles"
14+
style={{
15+
position: "absolute",
16+
top: 0,
17+
left: 0,
18+
}}
19+
options={{
20+
background: {
21+
color: {
22+
value: "transparent",
23+
},
24+
},
25+
fpsLimit: 60,
26+
interactivity: {
27+
detectsOn: "canvas",
28+
events: {
29+
onHover: {
30+
enable: true,
31+
mode: "repulse",
32+
},
33+
},
34+
modes: {
35+
repulse: {
36+
distance: 150,
37+
duration: 0.5,
38+
},
39+
},
40+
},
41+
particles: {
42+
color: {
43+
value: textAbovePrimaryColor,
44+
},
45+
links: {
46+
enable: true,
47+
color: textAbovePrimaryColor,
48+
blink: true,
49+
distance: 150,
50+
opacity: 0.5,
51+
width: 1,
52+
},
53+
collisions: {
54+
enable: false,
55+
mode: "bounce",
56+
},
57+
move: {
58+
direction: "none",
59+
enable: true,
60+
outMode: "bounce",
61+
random: false,
62+
speed: 3,
63+
straight: false,
64+
},
65+
number: {
66+
density: {
67+
enable: true,
68+
value_area: 800,
69+
},
70+
value: 80,
71+
},
72+
opacity: {
73+
value: 0.5,
74+
},
75+
shape: {
76+
type: "circle",
77+
},
78+
size: {
79+
random: true,
80+
value: 3,
81+
},
82+
},
83+
detectRetina: true,
84+
}}
85+
/>
86+
)}
87+
</div>
88+
);
89+
};

src/components/theme.ts

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
import { DefaultTheme } from "styled-components";
22
import { Colors } from "./styled";
33

4+
export const primaryColor = "#3F51B5";
5+
export const primaryColorDark = "#303F9F";
6+
export const primaryColorLight = "#DFDFF1";
7+
export const textAbovePrimaryColor = "#FFFFFF";
8+
49
export const dark: Colors = {
5-
primaryColor: "#3F51B5",
6-
primaryColorDark: "#303F9F",
7-
primaryColorLight: "#DFDFF1",
10+
primaryColor,
11+
primaryColorDark,
12+
primaryColorLight,
813
generalBackground: "#181918",
9-
textAbovePrimaryColor: "#FFFFFF",
14+
textAbovePrimaryColor,
1015
primaryTextColor: "#FAFAFA",
1116
secondaryTextColor: "#A6A6A6",
1217
accentColor: "#4fA7ff",
@@ -17,11 +22,11 @@ export const dark: Colors = {
1722
};
1823

1924
export const light: Colors = {
20-
primaryColor: "#3F51B5",
21-
primaryColorDark: "#303F9F",
22-
primaryColorLight: "#DFDFF1",
25+
primaryColor,
26+
primaryColorDark,
27+
primaryColorLight,
2328
generalBackground: "#FBFBFB",
24-
textAbovePrimaryColor: "#FFFFFF",
29+
textAbovePrimaryColor,
2530
primaryTextColor: "#151515",
2631
secondaryTextColor: "#575757",
2732
accentColor: "#1F67FF",

src/logic/device.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { isDesktop, isSafari } from "react-device-detect";
2+
import { useHardwareConcurrency, useMemoryStatus } from "react-adaptive-hooks";
3+
4+
export const isSafariDesktop = () => isSafari && isDesktop;
5+
6+
export const useIsPowerfulDesktop = () => {
7+
const { deviceMemory } = useMemoryStatus({ deviceMemory: 1 });
8+
const { numberOfLogicalProcessors } = useHardwareConcurrency();
9+
10+
return (
11+
isDesktop &&
12+
deviceMemory >= 8 &&
13+
numberOfLogicalProcessors != null &&
14+
numberOfLogicalProcessors >= 8
15+
);
16+
};

src/pages/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { ContainerFullscreen } from "../components/design-system/atoms/container
1111
import { Footer } from "../components/design-system/organism/footer";
1212
import { tracking } from "../logic/tracking";
1313
import { OgPageType } from "../logic/seo";
14+
import { BackgroundFullScreen } from "../components/background-fullscreen";
1415

1516
const HomePage: React.FC<PageProps> = ({ location }) => {
1617
const data = useStaticQuery<HomePageQuery>(
@@ -38,6 +39,7 @@ const HomePage: React.FC<PageProps> = ({ location }) => {
3839
imageUrl={`/${featuredImage}`}
3940
/>
4041
<ContainerFullscreen>
42+
<BackgroundFullScreen />
4143
<ProfilePresentation author={author} />
4244
<DownArrow />
4345
</ContainerFullscreen>

src/posts/2018-05-07-born-id3tageditor-mp3id3tagger.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "The first of a short series of post in which I describe my two lat
44
Mp3ID3Tagger. In this post I will talk about why I started to develop them."
55
date: 2018-05-07
66
image: ../images/posts/mp3id3tagger-id3tageditor.jpg
7-
tags: [swift, ios, apple, mobile application development, macOS]
7+
tags: [swift, ios, apple, mobile application development, macos]
88
comments: true
99
math: false
1010
authors: [fabrizio_duroni]

0 commit comments

Comments
 (0)