Skip to content

Commit 4b71974

Browse files
committed
Remove unused ImageClient component and clean up routes in CSR and SSR
1 parent 27fcc22 commit 4b71974

5 files changed

Lines changed: 26 additions & 70 deletions

File tree

test-app/app/components/ImageClient.tsx

Lines changed: 0 additions & 42 deletions
This file was deleted.

test-app/app/components/basic.tsx

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export const Basic = () => {
1212
alt="Image without ImageKit provider"
1313
height={300}
1414
width={300}
15-
style={{ color: "red" }} // we add `color:red` styles in all Image because otherwise Next.js may add `color:transparent` styles to the image. This may causes flaky tests.
1615
/>
1716

1817
<ImageKitProvider urlEndpoint="https://ik.imagekit.io/demo/">
@@ -21,27 +20,22 @@ export const Basic = () => {
2120
alt="Image with ImageKit provider"
2221
height={300}
2322
width={300}
24-
style={{ color: "red" }}
2523
/>
2624

25+
{/* Width not number */}
2726
<Image
2827
src="/default-image.jpg"
29-
alt="With transformation"
30-
transformation={[{ height: 100, width: 100 }]}
31-
height={300}
32-
width={300}
33-
style={{ color: "red" }}
28+
alt="Image with width not number, should produce larger srcset"
29+
// @ts-ignore
30+
width="300px"
3431
/>
3532

36-
{/* quality={50} */}
3733
<Image
3834
src="/default-image.jpg"
39-
alt="Image with quality"
40-
quality={50}
35+
alt="With transformation"
4136
transformation={[{ height: 100, width: 100 }]}
4237
height={300}
4338
width={300}
44-
style={{ color: "red" }}
4539
/>
4640

4741
<Image
@@ -53,7 +47,6 @@ export const Basic = () => {
5347
transformation={[{ height: 100, width: 100 }]}
5448
height={300}
5549
width={300}
56-
style={{ color: "red" }}
5750
/>
5851

5952
{/* responsive images with sizes */}
@@ -63,7 +56,15 @@ export const Basic = () => {
6356
sizes="(max-width: 600px) 100vw, 50vw"
6457
height={300}
6558
width={300}
66-
style={{ color: "red" }}
59+
/>
60+
61+
{/* responsive images with sizes not having vw token */}
62+
<Image
63+
src="/default-image.jpg"
64+
alt="Responsive image with sizes - should have very large srcset for all breakpoints"
65+
sizes="300px"
66+
height={300}
67+
width={300}
6768
/>
6869

6970
{/* urlEndpoint override */}
@@ -74,7 +75,6 @@ export const Basic = () => {
7475
transformation={[{ height: 100, width: 100 }]}
7576
height={300}
7677
width={300}
77-
style={{ color: "red" }}
7878
/>
7979

8080
{/* Pass className to the image tag as it is */}
@@ -84,7 +84,6 @@ export const Basic = () => {
8484
className="custom-class"
8585
height={300}
8686
width={300}
87-
style={{ color: "red" }}
8887
/>
8988

9089
{/* Lazy loading eager */}
@@ -94,7 +93,6 @@ export const Basic = () => {
9493
loading="eager"
9594
height={300}
9695
width={300}
97-
style={{ color: "red" }}
9896
/>
9997

10098
{/* Transformation position test */}
@@ -104,7 +102,16 @@ export const Basic = () => {
104102
transformationPosition="path"
105103
height={300}
106104
width={300}
107-
style={{ color: "red" }}
105+
/>
106+
107+
{/* Transformation position test with custom transformations */}
108+
<Image
109+
src="/default-image.jpg"
110+
alt="Image with path transformation + custom transformations"
111+
transformationPosition="path"
112+
transformation={[{ height: 100, width: 100 }]}
113+
height={300}
114+
width={300}
108115
/>
109116

110117
<Image
@@ -113,7 +120,6 @@ export const Basic = () => {
113120
transformationPosition="path"
114121
height={300}
115122
width={300}
116-
style={{ color: "red" }}
117123
/>
118124

119125
{/* Responsive off */}
@@ -125,8 +131,7 @@ export const Basic = () => {
125131
transformation={[{
126132
named: "restrict-unnamed",
127133
}]}
128-
style={{ color: "red" }}
129-
responsive={false}
134+
responsive={true}
130135
sizes="(max-width: 600px) 100vw, 50vw"
131136
/>
132137

test-app/app/routes/csr.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Basic } from "~/components/basic";
22
import type { Route } from "./+types/home";
3-
import { ImageEvents } from "~/components/ImageClient";
43
import { useState, useEffect } from "react";
54

65
export function meta({ }: Route.MetaArgs) {
@@ -26,8 +25,6 @@ export default function CSR() {
2625
return (
2726
<div className="container">
2827
<Basic />
29-
<h1>Advanced</h1>
30-
<ImageEvents />
3128
</div>
3229
)
3330
}

test-app/app/routes/ssr.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Basic } from "~/components/basic";
22
import type { Route } from "./+types/home";
3-
import { ImageEvents } from "~/components/ImageClient";
43

54
export function meta({}: Route.MetaArgs) {
65
return [
@@ -13,8 +12,6 @@ export default function SSR() {
1312
return (
1413
<div className="container">
1514
<Basic />
16-
<h1>Advanced</h1>
17-
<ImageEvents />
1815
</div>
1916
)
2017
}

test-app/vite.config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { reactRouter } from "@react-router/dev/vite";
2-
import tailwindcss from "@tailwindcss/vite";
32
import { defineConfig } from "vite";
43
import tsconfigPaths from "vite-tsconfig-paths";
54

65
export default defineConfig({
7-
plugins: [tailwindcss(), reactRouter(), tsconfigPaths()],
6+
plugins: [reactRouter(), tsconfigPaths()],
87
});

0 commit comments

Comments
 (0)