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

Commit aed382d

Browse files
committed
Trying to fix parameter layout switch 🚀
1 parent 0da5235 commit aed382d

File tree

9 files changed

+68
-66
lines changed

9 files changed

+68
-66
lines changed

gatsby-config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const config: GatsbyConfig = {
7272
{
7373
resolve: `gatsby-plugin-offline`,
7474
options: {
75-
precachePages: [`/`, `/blog/`],
75+
precachePages: [`/`],
7676
},
7777
},
7878
"gatsby-plugin-sharp",

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
"prebuild": "npm run clean",
4040
"build": "gatsby build",
4141
"predeploy": "npm run clean && npm run build",
42-
"deploy": "gh-pages -d public -b main"
42+
"deploy": "gh-pages -d public -b main",
43+
"typecheck": "tsc --noEmit"
4344
},
4445
"dependencies": {
4546
"@loadable/component": "^5.15.3",

src/components/design-system/art-colors.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const primaryColorLight = "#F7BEC6";
77

88
export const artDark: Colors = {
99
primaryColor: artPrimaryColor,
10+
secondaryColor: artPrimaryColor,
1011
primaryColorDark,
1112
primaryColorLight,
1213
generalBackground: "#181918",
@@ -22,6 +23,7 @@ export const artDark: Colors = {
2223

2324
export const artLight: Colors = {
2425
primaryColor: artPrimaryColor,
26+
secondaryColor: artPrimaryColor,
2527
primaryColorDark,
2628
primaryColorLight,
2729
generalBackground: "#FBFBFB",

src/components/design-system/organism/resume.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { FC, useState } from "react";
1+
import { FC, useState } from "react";
22
import { tracking } from "../../../logic/tracking";
33
import { ContainerFluid } from "../atoms/container-fluid";
44
import styled from "styled-components";

src/components/design-system/templates/blog-generic-post-list-page-template.tsx

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -60,42 +60,43 @@ export interface BlogGenericPostListPageProps {
6060
trackingCategory: string;
6161
}
6262

63-
export const BlogGenericPostListPageTemplate: FC<BlogGenericPostListPageProps> =
64-
({
65-
title,
66-
posts,
67-
author,
68-
location,
69-
ogPageType,
70-
ogImage,
71-
trackingCategory,
72-
}) => (
73-
<BlogPageTemplate
74-
location={location}
75-
author={author}
76-
ogPageType={ogPageType}
77-
ogImage={ogImage}
78-
trackingCategory={trackingCategory}
79-
>
80-
<PageTitle>{title}</PageTitle>
81-
{posts.map((post) => (
82-
<PostContainer key={post.node.fields!.slug!}>
83-
<Column size={"15%"}>
84-
<PostTime>{post.node.frontmatter?.date}</PostTime>
85-
</Column>
86-
<Column size={"85%"}>
87-
<PostLink
88-
to={post.node.fields!.slug!}
89-
trackingData={{
90-
action: tracking.action.open_blog_post,
91-
category: trackingCategory,
92-
label: tracking.label.body,
93-
}}
94-
>
95-
{post.node.frontmatter?.title}
96-
</PostLink>
97-
</Column>
98-
</PostContainer>
99-
))}
100-
</BlogPageTemplate>
101-
);
63+
export const BlogGenericPostListPageTemplate: FC<
64+
BlogGenericPostListPageProps
65+
> = ({
66+
title,
67+
posts,
68+
author,
69+
location,
70+
ogPageType,
71+
ogImage,
72+
trackingCategory,
73+
}) => (
74+
<BlogPageTemplate
75+
location={location}
76+
author={author}
77+
ogPageType={ogPageType}
78+
ogImage={ogImage}
79+
trackingCategory={trackingCategory}
80+
>
81+
<PageTitle>{title}</PageTitle>
82+
{posts.map((post) => (
83+
<PostContainer key={post.node.fields!.slug!}>
84+
<Column size={"15%"}>
85+
<PostTime>{post.node.frontmatter?.date}</PostTime>
86+
</Column>
87+
<Column size={"85%"}>
88+
<PostLink
89+
to={post.node.fields!.slug!}
90+
trackingData={{
91+
action: tracking.action.open_blog_post,
92+
category: trackingCategory,
93+
label: tracking.label.body,
94+
}}
95+
>
96+
{post.node.frontmatter?.title}
97+
</PostLink>
98+
</Column>
99+
</PostContainer>
100+
))}
101+
</BlogPageTemplate>
102+
);

src/components/design-system/templates/blog-page-template.tsx

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import styled from "styled-components";
99
import { Container } from "../atoms/container";
1010
import { blogPrimaryColor } from "../blog-colors";
1111
import { FC, ReactNode } from "react";
12+
import { pageOpenedInApp } from "../../../logic/app";
1213

1314
const Footer = loadable(() => import(`../organism/footer`));
1415

@@ -21,20 +22,6 @@ const ContentContainerApp = styled(Container)`
2122
flex: 1 0 auto;
2223
`;
2324

24-
export interface BlogPageProps {
25-
location: CurrentLocation;
26-
author: string;
27-
ogPageType: OgPageType;
28-
ogImage: string;
29-
trackingCategory: string;
30-
pageOpenedInApp: boolean;
31-
customTitle?: string;
32-
description?: string;
33-
date?: string;
34-
big?: boolean;
35-
children?: ReactNode;
36-
}
37-
3825
const StandardLayout: FC<{
3926
location: CurrentLocation;
4027
trackingCategory: string;
@@ -57,20 +44,31 @@ const StandardLayout: FC<{
5744
);
5845
};
5946

47+
export interface BlogPageProps {
48+
location: CurrentLocation;
49+
author: string;
50+
ogPageType: OgPageType;
51+
ogImage: string;
52+
trackingCategory: string;
53+
customTitle?: string;
54+
description?: string;
55+
date?: string;
56+
big?: boolean;
57+
children?: ReactNode;
58+
}
59+
6060
export const BlogPageTemplate: FC<BlogPageProps> = ({
6161
children,
6262
location,
6363
author,
6464
ogPageType,
6565
ogImage,
6666
trackingCategory,
67-
pageOpenedInApp,
6867
customTitle,
6968
description,
7069
date,
7170
big = false,
7271
}) => {
73-
console.log("from app", pageOpenedInApp);
7472
return (
7573
<BlogThemePage>
7674
<Head
@@ -82,7 +80,7 @@ export const BlogPageTemplate: FC<BlogPageProps> = ({
8280
date={date}
8381
cookieConsentColor={blogPrimaryColor}
8482
/>
85-
{!pageOpenedInApp ? (
83+
{!pageOpenedInApp(location) ? (
8684
<StandardLayout
8785
location={location}
8886
big={big}

src/logic/app.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { WindowLocation } from "@reach/router";
1+
import { CurrentLocation } from "./current-location";
22

3-
export const pageOpenedInApp = (
4-
location: WindowLocation<WindowLocation["state"]>,
5-
): boolean => {
3+
export const pageOpenedInApp = (location: CurrentLocation): boolean => {
64
const appParam = new URLSearchParams(location.search).get("app");
75
return appParam !== undefined && appParam !== null && appParam === "true";
86
};

src/logic/current-location.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import { WindowLocation } from "@reach/router";
33
export interface CurrentLocation {
44
url: string;
55
pathname: string;
6+
search: string;
67
}
78

89
export const getCurrentLocationFrom: (
910
location: WindowLocation<WindowLocation["state"]>,
1011
) => CurrentLocation = (location: WindowLocation<WindowLocation["state"]>) => ({
1112
url: location.href,
1213
pathname: location.pathname,
14+
search: location.search
1315
});

src/templates/post.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@ const PostContainer = styled.div`
3737
const Post: FC<PageProps<Queries.PostQuery>> = ({ data, location }) => {
3838
const post = data.markdownRemark!;
3939
const title = post.frontmatter!.title!;
40+
const currentLocation = getCurrentLocationFrom(location);
4041

4142
if (post.frontmatter?.math === true) {
4243
require("katex/dist/katex.min.css");
4344
}
4445

4546
return (
4647
<BlogPageTemplate
47-
location={getCurrentLocationFrom(location)}
48+
location={currentLocation}
4849
author={data.site!.siteMetadata!.author!}
4950
ogPageType={OgPageType.BlogPosting}
5051
ogImage={`${getSrc(
@@ -54,7 +55,6 @@ const Post: FC<PageProps<Queries.PostQuery>> = ({ data, location }) => {
5455
customTitle={title}
5556
description={post.frontmatter!.description!}
5657
date={post.frontmatter!.date!}
57-
pageOpenedInApp={pageOpenedInApp(location)}
5858
>
5959
<PostContainer>
6060
<PostTitle className="blog-post-title">
@@ -77,7 +77,7 @@ const Post: FC<PageProps<Queries.PostQuery>> = ({ data, location }) => {
7777
trackingLabel={tracking.label.body}
7878
/>
7979
</PostContainer>
80-
{!pageOpenedInApp(location) && (
80+
{!pageOpenedInApp(currentLocation) && (
8181
<>
8282
<RecentPosts currentSlug={location.pathname} />
8383
{post.frontmatter?.comments && (

0 commit comments

Comments
 (0)