Skip to content

Commit

Permalink
fix: remove global variable
Browse files Browse the repository at this point in the history
  • Loading branch information
fbuireu committed May 3, 2024
1 parent dec55f2 commit 8825801
Show file tree
Hide file tree
Showing 10 changed files with 316 additions and 174 deletions.
Binary file modified .yarn/install-state.gz
Binary file not shown.
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@
},
"dependencies": {
"@astrojs/check": "^0.5.10",
"@astrojs/cloudflare": "^10.2.4",
"@astrojs/cloudflare": "^10.2.5",
"@astrojs/mdx": "^2.3.1",
"@astrojs/partytown": "^2.1.0",
"@astrojs/react": "^3.3.1",
"@astrojs/react": "^3.3.2",
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.4",
"@fontsource-variable/nunito-sans": "^5.0.14",
"@fontsource/baskervville": "^5.0.20",
"@hookform/resolvers": "^3.3.4",
"astro": "^4.7.0",
"astro": "^4.7.1",
"firebase": "^10.11.1",
"firebase-admin": "^12.1.0",
"gsap": "^3.12.5",
Expand All @@ -66,26 +66,26 @@
"resend": "^3.2.0",
"swiper": "^11.1.1",
"three": "^0.164.1",
"zod": "^3.23.5"
"zod": "^3.23.6"
},
"devDependencies": {
"@astrojs/ts-plugin": "^1.6.1",
"@biomejs/biome": "1.7.1",
"@biomejs/biome": "1.7.2",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@testing-library/react": "^15.0.5",
"@testing-library/react": "^15.0.6",
"@testing-library/react-hooks": "^8.0.1",
"@types/markdown-it": "^14.0.1",
"@types/node": "^20.12.7",
"@types/markdown-it": "^14.1.1",
"@types/node": "^20.12.8",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@types/three": "^0.164.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"stylelint": "^16.4.0",
"stylelint": "^16.5.0",
"stylelint-config-recommended": "^14.0.0",
"stylelint-order": "^6.0.4",
"typescript": "^5.4.5",
"vitest": "^1.5.2"
"vitest": "^1.5.3"
}
}
5 changes: 0 additions & 5 deletions src/global.d.ts

This file was deleted.

5 changes: 3 additions & 2 deletions src/pages/articles/[...slug].astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import BaseLayout from "src/ui/components/templates/baseLayout/BaseLayout.astro"
import "./_article.css";
import { DEFAULT_DATE_FORMAT } from "src/consts";
import { slugify } from "src/ui/shared/utils/slugify";
import { ImageMetadata } from "astro";
export const prerender = true;
Expand All @@ -23,7 +24,7 @@ export async function getStaticPaths() {
}
const MAX_RELATED_ARTICLES = 3;
const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/**/*.{jpeg,jpg,png,gif}");
const articles = await getCollection("articles");
const { currentArticle } = Astro.props as ArticleProps;
Expand All @@ -40,7 +41,7 @@ const relatedArticles = articles
featuredImage && (
<section class="article__featured__image__wrapper">
<Image
src={images[featuredImage]() as ImageType}
src={images[featuredImage]()}
alt={title}
class="article__featured__image"
transition:name="article-featured-image"
Expand Down
7 changes: 4 additions & 3 deletions src/pages/articles/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ import { slugify } from "@shared/utils/slugify";
import { DEFAULT_DATE_FORMAT } from "src/consts";
import "./_articles.css";
import horizontalArrow from "@assets/images/svg/left-arrow.svg";
import { ImageMetadata } from "astro";
enum ArticleType {
DEFAULT = "default",
NO_IMAGE = "no_image",
}
const articles = await getCollection("articles");
const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/**/*.{jpeg,jpg,png,gif}");
articles.sort((a, b) => new Date(b.data?.publishDate).valueOf() - new Date(a.data?.publishDate).valueOf());
Expand Down Expand Up @@ -47,7 +48,7 @@ const featuredArticleShareUrl = new URL(featuredArticleHref, Astro.url).href;
<a href={`/articles/${featuredArticleSlug}`}>
<Image
class="featured-article__image"
src={images[featuredArticle.featuredImage]() as ImageType}
src={images[featuredArticle.featuredImage]()}
alt={featuredArticle.title}
/>
</a>
Expand Down Expand Up @@ -116,7 +117,7 @@ const featuredArticleShareUrl = new URL(featuredArticleHref, Astro.url).href;
}`}
>
{article.featuredImage && (
<Image class="article__card__image" src={images[article.featuredImage]() as ImageType} alt={article.title} />
<Image class="article__card__image" src={images[article.featuredImage]()} alt={article.title} />
)}
<time class="article__card__publish-date font-sans-serif" datetime={publishedDate}>
{publishedDate}
Expand Down
1 change: 0 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import LatestArticles from "@components/organisms/latestArticles/LatestArticles.
// todo: Home:
// -: Use Slider for latest articles
// todo: multilanguage*
// todo: add global types (imageType etc)
// todo: improve isolation
// todo: add thinner svg lines
// todo: reduce XXSS module
Expand Down
11 changes: 6 additions & 5 deletions src/pages/projects.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
import BaseLayout from "@components/templates/baseLayout/BaseLayout.astro";
import { Image } from "astro:assets";
import ProjectSection from "@components/atoms/projectSection/ProjectSection.astro";
import { ImageMetadata } from "astro";
const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/**/*.{jpeg,jpg,png,gif}");
---

<BaseLayout title="" description="">
Expand All @@ -13,7 +14,7 @@ const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="project-image" slot="project-image">
<Image src={images['/src/assets/images/jpg/stories-of-impact.jpg']() as ImageType} alt="Stories of Impact" />
<Image src={images['/src/assets/images/jpg/stories-of-impact.jpg']()} alt="Stories of Impact" />
</div>
</ProjectSection>
<ProjectSection id="reports-and-thought-leadership">
Expand All @@ -22,7 +23,7 @@ const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="project-image" slot="project-image">
<Image src={images['/src/assets/images/jpg/thought-leadership.jpg']() as ImageType} alt="Reports & Thought Leadership" />
<Image src={images['/src/assets/images/jpg/thought-leadership.jpg']()} alt="Reports & Thought Leadership" />
</div>
</ProjectSection>
<ProjectSection id="creative-direction">
Expand All @@ -31,7 +32,7 @@ const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="project-image" slot="project-image">
<Image src={images['/src/assets/images/jpg/creative-direction.jpg']() as ImageType} alt="Creative Direction" />
<Image src={images['/src/assets/images/jpg/creative-direction.jpg']()} alt="Creative Direction" />
</div>
</ProjectSection>
<ProjectSection id="web-content">
Expand All @@ -40,7 +41,7 @@ const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
<p>Lorem ipsum dolor sit amet</p>
</div>
<div class="project-image" slot="project-image">
<Image src={images['/src/assets/images/jpg/web-content.jpg']() as ImageType} alt="Web Content" />
<Image src={images['/src/assets/images/jpg/web-content.jpg']()} alt="Web Content" />
</div>
</ProjectSection>
</BaseLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
{article.featuredImage && (
<Image
class="latest__article__item__featured-image"
src={images[`${article.featuredImage}`]() as ImageType}
src={images[`${article.featuredImage}`]()}
alt={article.title}
transition:name="featured-image"
/>
Expand Down
11 changes: 6 additions & 5 deletions src/ui/components/organisms/myWork/MyWork.astro
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
---
import { Image } from "astro:assets";
import "./my-work.css";
import type { ImageMetadata } from "astro";
const images = import.meta.glob("/src/assets/**/*.{jpeg,jpg,png,gif}");
const images = import.meta.glob<{ default: ImageMetadata }>("/src/assets/**/*.{jpeg,jpg,png,gif}");
---

<section class="my-work__wrapper common-wrapper">
<h3 class="my-work__title section-title">My Work</h3>
<ul class="my-work__content__list flex row-wrap justify-space-between">
<li class="my-work__item">
<a class="my-work__item__link clickable" href="/projects#stories-of-impact">
<Image src={images['/src/assets/images/jpg/stories-of-impact.jpg']() as ImageType} alt="Stories of Impact" />
<Image src={images['/src/assets/images/jpg/stories-of-impact.jpg']()} alt="Stories of Impact" />
<h4 class="my-work__item__title inner-section-title">Stories of Impact</h4>
</a>
</li>
<li class="my-work__item">
<a class="my-work__item__link clickable" href="/projects#reports-and-thought-leadership">
<Image src={images['/src/assets/images/jpg/thought-leadership.jpg']() as ImageType} alt="Reports & Thought Leadership" />
<Image src={images['/src/assets/images/jpg/thought-leadership.jpg']()} alt="Reports & Thought Leadership" />
<h4 class="my-work__item__title inner-section-title">Reports & Thought Leadership</h4>
</a>
</li>
<li class="my-work__item">
<a class="my-work__item__link clickable" href="/projects#creative-direction">
<Image src={images['/src/assets/images/jpg/creative-direction.jpg']() as ImageType} alt="Creative Direction" />
<Image src={images['/src/assets/images/jpg/creative-direction.jpg']()} alt="Creative Direction" />
<h4 class="my-work__item__title inner-section-title">Creative Direction</h4>
</a>
</li>
<li class="my-work__item">
<a class="my-work__item__link clickable" href="/projects#web-content">
<Image src={images['/src/assets/images/jpg/web-content.jpg']() as ImageType} alt="Web Content" />
<Image src={images['/src/assets/images/jpg/web-content.jpg']()} alt="Web Content" />
<h4 class="my-work__item__title inner-section-title">Web Content</h4>
</a>
</li>
Expand Down
Loading

0 comments on commit 8825801

Please sign in to comment.