Skip to content
This repository has been archived by the owner on May 11, 2022. It is now read-only.

refactor to use peer-types #17

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"husky": "7.0.4",
"lint-staged": "12.3.4",
"npm-run-all": "4.1.5",
"peer-types": "^1.0.2",
"postcss": "8.4.6",
"prettier": "2.5.1",
"rimraf": "3.0.2",
Expand Down
4 changes: 2 additions & 2 deletions src/components/SearchResult.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from "react";
import type { PlaceWithAccesibilityData } from "../types/place";
import { PlaceWithAccessibilityData } from "peer-types";
import Link from "next/link";

export const SearchResult: React.FC<{ place: PlaceWithAccesibilityData }> = ({
export const SearchResult: React.FC<{ place: PlaceWithAccessibilityData }> = ({
place,
}) => {
return (
Expand Down
8 changes: 4 additions & 4 deletions src/hooks/useSearchPlaces.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useEffect, useState } from "react";
import type { PlaceWithAccesibilityData } from "../types/place";
import { PlaceWithAccessibilityData } from "peer-types";

export const useSearchPlaces = ({
searchText,
}: {
searchText: string;
}): {
places: PlaceWithAccesibilityData[];
places: PlaceWithAccessibilityData[];
loading: boolean;
error: string | null;
} => {
const [places, setPlaces] = useState<PlaceWithAccesibilityData[]>([]);
const [places, setPlaces] = useState<PlaceWithAccessibilityData[]>([]);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<string | null>(null);

Expand All @@ -27,7 +27,7 @@ export const useSearchPlaces = ({
.replaceAll(" ", "+")}&includeRatings=true`
);
const data = (await response.json()) as {
places: PlaceWithAccesibilityData[];
places: PlaceWithAccessibilityData[];
};
setPlaces(data.places);
} catch (error) {
Expand Down
12 changes: 0 additions & 12 deletions src/types/place.ts

This file was deleted.

5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2332,6 +2332,11 @@ path-type@^4.0.0:
resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==

peer-types@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/peer-types/-/peer-types-1.0.2.tgz#1ec101f5c5e66a8e2180cc658ff91c25a7a77986"
integrity sha512-SgY/s0P0iWg6CLZKVWvEhtneFjLfLaMBCuMUKoEL0RV4RG8EAuUSueJAdO7YdMtzzFv1qt3mOWN9mUPIJKvUNA==

picocolors@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.0.tgz#cb5bdc74ff3f51892236eaf79d68bc44564ab81c"
Expand Down