Skip to content

Commit

Permalink
Upgrade to Cosmos 6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiuch committed Mar 6, 2024
1 parent 791f4a8 commit bcf9e85
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
"prettier-plugin-tailwindcss": "^0.3.0",
"prettier": "^2.5.1",
"query-string": "^8.1.0",
"react-cosmos-plugin-open-fixture": "6.0.4-canary.84a35da.0",
"react-cosmos-plugin-vite": "6.0.4-canary.84a35da.0",
"react-cosmos": "6.0.4-canary.84a35da.0",
"react-cosmos-plugin-open-fixture": "6.1.0",
"react-cosmos-plugin-vite": "6.1.0",
"react-cosmos": "6.1.0",
"react-dom": "18.2.0",
"react-intl": "^6.4.2",
"react-leaflet": "^4.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect } from "react";
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { SelectOption } from "../select/Select";
import { Autocomplete } from "./Autocomplete";

Expand All @@ -10,12 +10,12 @@ const assets: SelectOption[] = Array.from(Array(1000).keys()).map((x) => ({

export default {
Basic: () => {
const [value, setValue] = useInput("option", assets[10].value);
const [value, setValue] = useFixtureInput("option", assets[10].value);

return <Autocomplete options={assets} value={value} onChange={setValue} />;
},
WithInterval: () => {
const [value, setValue] = useInput("option", "");
const [value, setValue] = useFixtureInput("option", "");

useEffect(() => {
if (!value) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/src/components/ui/form/select/Select.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { Select, SelectOption } from "./Select";

const assets: SelectOption[] = Array.from(Array(100).keys()).map((x) => ({
Expand All @@ -8,7 +8,7 @@ const assets: SelectOption[] = Array.from(Array(100).keys()).map((x) => ({

const fixture = {
Basic: () => {
const [value, setValue] = useInput("value", assets[10].value);
const [value, setValue] = useFixtureInput("value", assets[10].value);

return (
<Select
Expand Down
12 changes: 6 additions & 6 deletions frontend/web/src/components/ui/map/Map.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { DEFAULT_MAP_CENTER } from "../../../constants";
import { Map } from "./Map";
import { MapFollowControl } from "./MapFollowControl";
Expand Down Expand Up @@ -112,8 +112,8 @@ export default {
return <Map center={DEFAULT_MAP_CENTER} />;
},
WithPin: () => {
const [latitude] = useInput("latitude", 46.770439);
const [longitude] = useInput("longitude", 23.591423);
const [latitude] = useFixtureInput("latitude", 46.770439);
const [longitude] = useFixtureInput("longitude", 23.591423);

return (
<Map center={DEFAULT_MAP_CENTER}>
Expand All @@ -125,9 +125,9 @@ export default {
);
},
WithFollow: () => {
const [latitude, setLatitude] = useInput("latitude", 46.770439);
const [longitude, setLongitude] = useInput("longitude", 23.591423);
const [follow, setFollow] = useInput("follow", true);
const [latitude, setLatitude] = useFixtureInput("latitude", 46.770439);
const [longitude, setLongitude] = useFixtureInput("longitude", 23.591423);
const [follow, setFollow] = useFixtureInput("follow", true);

const [interval, setLocalInterval] = useState<NodeJS.Timeout>();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { appConfigAtom } from "@navtrack/shared/state/appConfig";
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { useSetRecoilState } from "recoil";
import { DEFAULT_MAP_CENTER } from "../../../../constants";
import { Modal } from "../../modal/Modal";
Expand Down Expand Up @@ -55,7 +55,7 @@ export default {
);
},
"With geofence": () => {
const [geofence, setGeofence] = useInput("geofence", {
const [geofence, setGeofence] = useFixtureInput("geofence", {
latitude: 46.763266,
longitude: 23.555374,
radius: 319
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/src/components/ui/slider/Slider.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { Slider } from "./Slider";

export default function Fixture() {
const [value, setValue] = useInput("slider", 25);
const [value, setValue] = useFixtureInput("slider", 25);

return (
<Slider
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/src/components/ui/switch/Switch.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { Switch } from "./Switch";

export default {
Basic: () => {
const [checked, setChecked] = useInput("checked", false);
const [checked, setChecked] = useFixtureInput("checked", false);

return <Switch checked={checked} onChange={setChecked} />;
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/src/components/ui/table/TableV2.fixture.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useInput } from "react-cosmos/client";
import { useFixtureInput } from "react-cosmos/client";
import { ITableColumn, TableV2 } from "./TableV2";

type User = {
Expand Down Expand Up @@ -43,7 +43,7 @@ export default {
Loading: <TableV2 columns={columns} rows={undefined} />,
"No Items": <TableV2 columns={columns} rows={[]} />,
"With Selected Item": () => {
const [user, setUser] = useInput<User | undefined>("user", users[2]);
const [user, setUser] = useFixtureInput<User | undefined>("user", users[2]);

return (
<TableV2
Expand Down

0 comments on commit bcf9e85

Please sign in to comment.