take the smallest breakpoint as default when creating a new project

no longer require to have a 0 minWidth breakpoint
This commit is contained in:
Oleg Isonen committed 2022-05-11 00:18:03 +02:00
1 parent 54373336ee
commit ab9835b30d
1 file changed
+3 -3
+3 -3
View File
@@ -7,11 +7,11 @@ import {
import { applyPatches, type Patch } from "immer";
import { prisma } from "./prisma.server";
import { createInstance } from "~/shared/tree-utils";
import { sort } from "~/shared/breakpoints";
export const createRootInstance = (breakpoints: Array<Breakpoint>) => {
const defaultBreakpoint = breakpoints.find(
(breakpoint) => breakpoint.minWidth === 0
);
// Take the smallest breakpoint as default
const defaultBreakpoint = sort(breakpoints)[0];
if (defaultBreakpoint === undefined) {
throw new Error("A breakpoint with minWidth 0 is required");
}