Skip to content

Commit

Permalink
move ChecklistLayout to model
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicamcinchak committed Jan 6, 2025
1 parent e6b74ed commit 2a79fac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import Grid from "@mui/material/Grid";
import { visuallyHidden } from "@mui/utils";
import { checklistValidationSchema } from "@planx/components/Checklist/model";
import {
ChecklistLayout,
checklistValidationSchema,
} from "@planx/components/Checklist/model";
import Card from "@planx/components/shared/Preview/Card";
import { CardHeader } from "@planx/components/shared/Preview/CardHeader/CardHeader";
import { getIn, useFormik } from "formik";
Expand All @@ -19,12 +22,6 @@ import { toggleNonExclusiveCheckbox } from "./helpers";
import { useExclusiveOption } from "./hooks/useExclusiveOption";
import { useSortedOptions } from "./hooks/useSortedOptions";

export enum ChecklistLayout {
Basic,
Grouped,
Images,
}

const ChecklistComponent: React.FC<Props> = (props) => {
const {
description = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from "react";
import FormWrapper from "ui/public/FormWrapper";
import ChecklistItem from "ui/shared/ChecklistItem/ChecklistItem";

import { ChecklistLayout } from "../Public";
import { ChecklistLayout } from "../../model";

interface Props {
nonExclusiveOptions: Option[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { setup } from "testUtils";
import { vi } from "vitest";
import { axe } from "vitest-axe";

import Checklist, { ChecklistLayout } from "../Public";
import { ChecklistLayout } from "../../model";
import Checklist from "../Public";
import { groupedOptions, options } from "./mockOptions";
import { pressContinue, pressOption } from "./testUtils";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Option } from "@planx/components/shared";

import { Group } from "../../model";
import { ChecklistLayout } from "../Public";
import { ChecklistLayout, Group } from "../../model";

export const options: {
[key in ChecklistLayout]?: Array<Option>;
Expand Down
7 changes: 6 additions & 1 deletion editor.planx.uk/src/@planx/components/Checklist/model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { array } from "yup";

import { BaseNodeData, Option } from "../shared";
import { ChecklistLayout } from "./Public/Public";

export enum ChecklistLayout {
Basic,
Grouped,
Images,
}

export interface Group<T> {
title: string;
Expand Down

0 comments on commit 2a79fac

Please sign in to comment.