Skip to content

Commit cab6ef0

Browse files
committed
chore: run prettier
1 parent 63adf16 commit cab6ef0

File tree

9 files changed

+190
-198
lines changed

9 files changed

+190
-198
lines changed

@types/generated/contentful.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export interface ICoachFields {
193193
/** Die Coaches */
194194

195195
export interface ICoach extends Entry<ICoachFields> {
196-
fields: ICoachFields
196+
fields: ICoachFields;
197197
sys: {
198198
id: string;
199199
type: string;

app/components/CoachSearch.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import SearchBar from "./SearchBar";
22

3-
4-
function CoachSearch() {
5-
return (
6-
<div className="flex flex-row flex-grow w-full lg:w-10 ">
7-
<SearchBar />
8-
</div>
9-
);
3+
function CoachSearch() {
4+
return (
5+
<div className="flex flex-row flex-grow w-full lg:w-10 ">
6+
<SearchBar />
7+
</div>
8+
);
109
}
1110

12-
export default CoachSearch;
11+
export default CoachSearch;

app/components/SearchBar.tsx

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
1-
import React, { ChangeEvent, useRef } from 'react';
2-
1+
import React, { ChangeEvent, useRef } from "react";
32

43
const SearchBar = () => {
4+
const [inputValue, setInputValue] = React.useState("");
5+
const [debouncedInputValue, setDebouncedInputValue] = React.useState("");
6+
const inputRef = useRef<HTMLInputElement>(null);
57

6-
const [inputValue, setInputValue] = React.useState("")
7-
const [debouncedInputValue, setDebouncedInputValue] = React.useState("")
8-
const inputRef = useRef<HTMLInputElement>(null);
9-
10-
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
11-
e.preventDefault();
12-
const clonedEvent = new Event(e.nativeEvent.type, e.nativeEvent);
13-
setInputValue(e.currentTarget.value)
14-
setTimeout(() => {
15-
if (inputRef.current) {
16-
inputRef.current.dispatchEvent(clonedEvent);
17-
}
18-
}, 1000);
19-
}
20-
8+
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
9+
e.preventDefault();
10+
const clonedEvent = new Event(e.nativeEvent.type, e.nativeEvent);
11+
setInputValue(e.currentTarget.value);
12+
setTimeout(() => {
13+
if (inputRef.current) {
14+
inputRef.current.dispatchEvent(clonedEvent);
15+
}
16+
}, 1000);
17+
};
2118

22-
return (
23-
<div className="inline-flex gap-2 w-full lg:w-96">
24-
<input
25-
name="search"
26-
type="text"
27-
28-
placeholder="Suche..."
29-
className="text-[1rem] px-2 py-1 rounded-full hover:text-vsp-900 border border-vsp-400 active:border-vsp-900 focus:border-vsp-900 disabled:border-vsp-200 w-full"
30-
value={inputValue}
31-
onChange={(e) => {handleInputChange(e)}}
32-
>
33-
</input>
34-
{/* <button
19+
return (
20+
<div className="inline-flex gap-2 w-full lg:w-96">
21+
<input
22+
name="search"
23+
type="text"
24+
placeholder="Suche..."
25+
className="text-[1rem] px-2 py-1 rounded-full hover:text-vsp-900 border border-vsp-400 active:border-vsp-900 focus:border-vsp-900 disabled:border-vsp-200 w-full"
26+
value={inputValue}
27+
onChange={(e) => {
28+
handleInputChange(e);
29+
}}
30+
></input>
31+
{/* <button
3532
className="py-2 px-2 font-inherit inline-flex items-center justify-center rounded-full text-vsp-900 hover:text-white no-underline transition-opacity duration-300 hover:bg-vsp-900 focus:opacity-90 active:opacity-90 disabled:pointer-events-none "
3633
type="button"
3734
disabled={!searchTerm}
3835
onClick={()=>{setSearchTerm('')}}
3936
>
4037
CLEAR
4138
</button> */}
42-
</div>
43-
);
39+
</div>
40+
);
4441
};
45-
export default SearchBar;
42+
export default SearchBar;

app/components/SpeakingTimeContent.tsx

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ export default function SpeakingTimeContent({
6060
if (formRef) {
6161
// not the best solution as the tags now will timeout for 300ms as well - but with the onchange on the form I could not find another way
6262
// to debounce the search input to not sent a request for each input .. happy for suggestions
63-
clearTimeout(timeout)
64-
timeout = setTimeout(() => submit(formRef.current, { replace: true, preventScrollReset: true }), 300);
63+
clearTimeout(timeout);
64+
timeout = setTimeout(
65+
() =>
66+
submit(formRef.current, { replace: true, preventScrollReset: true }),
67+
300,
68+
);
6569
}
6670
};
6771
const state = useNavigation();
6872

69-
7073
// sort tags to ensure the "quick response" one is always the first in the array
7174
tags.unshift(
7275
tags.splice(
@@ -83,30 +86,29 @@ export default function SpeakingTimeContent({
8386
<div>
8487
<ContentBlocks content={page.fields.content} locale={locale} />
8588
<Form
86-
onChange={handleChange}
87-
ref={formRef}
88-
method="get"
89-
id="filter-form"
90-
className="bg-slate-100"
91-
>
92-
<details open={false} className="mx-auto max-w-7xl pt-6 px-4">
93-
<summary
94-
className="inline-flex cursor-pointer items-center hover:text-vsp-500"
95-
onClick={() => setIsActive(!isActive)}
96-
>
97-
<FilterIcon />
98-
<h5 className="inline-block px-4 text-xl" id="details-filter">
99-
{t("filter.showFilter")}
100-
</h5>
101-
<div
102-
className={`transition-transform hover:text-vsp-500 ${
103-
isActive ? "rotate-180" : "rotate-0"
104-
}`}
89+
onChange={handleChange}
90+
ref={formRef}
91+
method="get"
92+
id="filter-form"
93+
className="bg-slate-100"
94+
>
95+
<details open={false} className="mx-auto max-w-7xl pt-6 px-4">
96+
<summary
97+
className="inline-flex cursor-pointer items-center hover:text-vsp-500"
98+
onClick={() => setIsActive(!isActive)}
10599
>
106-
<ArrowDown />
107-
</div>
108-
</summary>
109-
100+
<FilterIcon />
101+
<h5 className="inline-block px-4 text-xl" id="details-filter">
102+
{t("filter.showFilter")}
103+
</h5>
104+
<div
105+
className={`transition-transform hover:text-vsp-500 ${
106+
isActive ? "rotate-180" : "rotate-0"
107+
}`}
108+
>
109+
<ArrowDown />
110+
</div>
111+
</summary>
110112

111113
<fieldset className="mt-8">
112114
<legend className="mb-4 inline-block text-xl">
@@ -185,18 +187,15 @@ export default function SpeakingTimeContent({
185187
</button>
186188
</noscript>
187189
</div>
188-
</details>
189-
<div className="py-6 px-4 max-w-7xl mx-auto flex justify-end lg:justify-between items-center flex-wrap">
190-
191-
<CoachSearch />
192-
<div className="text-m font-semibold text-slate-700">
193-
{coachesAmount ? `${coachesAmount} ${t("result")}` : t("noResult")}
194-
</div>
195-
</div>
190+
</details>
191+
<div className="py-6 px-4 max-w-7xl mx-auto flex justify-end lg:justify-between items-center flex-wrap">
192+
<CoachSearch />
193+
<div className="text-m font-semibold text-slate-700">
194+
{coachesAmount ? `${coachesAmount} ${t("result")}` : t("noResult")}
195+
</div>
196+
</div>
196197
</Form>
197198

198-
199-
200199
<div className="relative">
201200
{state.state === "loading" && (
202201
<div className="absolute inset-0 z-50 flex items-start justify-center bg-white bg-opacity-50">
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
export default function SearchIcon({ classNames = "h-6 w-6" }) {
22
return (
3-
<svg
4-
5-
viewBox="-1 -3 25 30"
6-
fill="currentColor"
7-
className={classNames}
8-
>
9-
<path
10-
11-
d="m22.89,20.77l-8.2-8.2s0,0,0,0c.88-1.29,1.4-2.85,1.4-4.52C16.09,3.61,12.48,0,8.04,0S0,3.61,0,8.04s3.61,8.04,8.04,8.04c1.68,0,3.23-.52,4.52-1.4,0,0,0,0,0,0l8.2,8.2c.29.29.68.44,1.06.44s.77-.15,1.06-.44c.59-.59.59-1.54,0-2.12ZM2,8.04c0-3.33,2.71-6.04,6.04-6.04s6.04,2.71,6.04,6.04-2.71,6.04-6.04,6.04-6.04-2.71-6.04-6.04Z" ></path>
3+
<svg viewBox="-1 -3 25 30" fill="currentColor" className={classNames}>
4+
<path d="m22.89,20.77l-8.2-8.2s0,0,0,0c.88-1.29,1.4-2.85,1.4-4.52C16.09,3.61,12.48,0,8.04,0S0,3.61,0,8.04s3.61,8.04,8.04,8.04c1.68,0,3.23-.52,4.52-1.4,0,0,0,0,0,0l8.2,8.2c.29.29.68.44,1.06.44s.77-.15,1.06-.44c.59-.59.59-1.54,0-2.12ZM2,8.04c0-3.33,2.71-6.04,6.04-6.04s6.04,2.71,6.04,6.04-2.71,6.04-6.04,6.04-6.04-2.71-6.04-6.04Z"></path>
125
</svg>
136
);
147
}

app/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,4 @@ export default function App() {
115115

116116
export function ErrorBoundary() {
117117
return <BasicCatchBoundary />;
118-
}
118+
}
Lines changed: 75 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
1-
import { expect, test } from 'vitest'
2-
import { documentContentToSimpleString } from './documentToSimpleString'
1+
import { expect, test } from "vitest";
2+
import { documentContentToSimpleString } from "./documentToSimpleString";
33
const exampleDescription = {
4-
"data": {},
5-
"content": [
4+
data: {},
5+
content: [
6+
{
7+
data: {},
8+
content: [
69
{
7-
"data": {},
8-
"content": [
10+
data: {},
11+
content: [
12+
{
13+
data: {},
14+
content: [
915
{
10-
"data": {},
11-
"content": [
12-
{
13-
"data": {},
14-
"content": [
15-
{
16-
"data": {},
17-
"marks": [],
18-
"value": "A",
19-
"nodeType": "text"
20-
}
21-
],
22-
"nodeType": "paragraph"
23-
}
24-
],
25-
"nodeType": "list-item"
16+
data: {},
17+
marks: [],
18+
value: "A",
19+
nodeType: "text",
2620
},
21+
],
22+
nodeType: "paragraph",
23+
},
24+
],
25+
nodeType: "list-item",
26+
},
27+
{
28+
data: {},
29+
content: [
30+
{
31+
data: {},
32+
content: [
2733
{
28-
"data": {},
29-
"content": [
30-
{
31-
"data": {},
32-
"content": [
33-
{
34-
"data": {},
35-
"marks": [],
36-
"value": "B",
37-
"nodeType": "text"
38-
}
39-
],
40-
"nodeType": "paragraph"
41-
}
42-
],
43-
"nodeType": "list-item"
34+
data: {},
35+
marks: [],
36+
value: "B",
37+
nodeType: "text",
4438
},
45-
{
46-
"data": {},
47-
"content": [
48-
{
49-
"data": {},
50-
"content": [
51-
{
52-
"data": {},
53-
"marks": [],
54-
"value": "C",
55-
"nodeType": "text"
56-
}
57-
],
58-
"nodeType": "paragraph"
59-
}
60-
],
61-
"nodeType": "list-item"
62-
}
63-
],
64-
"nodeType": "unordered-list"
39+
],
40+
nodeType: "paragraph",
41+
},
42+
],
43+
nodeType: "list-item",
6544
},
6645
{
67-
"data": {},
68-
"content": [
46+
data: {},
47+
content: [
48+
{
49+
data: {},
50+
content: [
6951
{
70-
"data": {},
71-
"marks": [],
72-
"value": "",
73-
"nodeType": "text"
74-
}
75-
],
76-
"nodeType": "paragraph"
77-
}
78-
],
79-
"nodeType": "document"
80-
}
52+
data: {},
53+
marks: [],
54+
value: "C",
55+
nodeType: "text",
56+
},
57+
],
58+
nodeType: "paragraph",
59+
},
60+
],
61+
nodeType: "list-item",
62+
},
63+
],
64+
nodeType: "unordered-list",
65+
},
66+
{
67+
data: {},
68+
content: [
69+
{
70+
data: {},
71+
marks: [],
72+
value: "",
73+
nodeType: "text",
74+
},
75+
],
76+
nodeType: "paragraph",
77+
},
78+
],
79+
nodeType: "document",
80+
};
8181

82-
test('get simple string from Document object', () => {
83-
const simpleText = documentContentToSimpleString(exampleDescription.content);
84-
expect(simpleText).toEqual("ABC");
85-
})
82+
test("get simple string from Document object", () => {
83+
const simpleText = documentContentToSimpleString(exampleDescription.content);
84+
expect(simpleText).toEqual("ABC");
85+
});

0 commit comments

Comments
 (0)