Skip to content

Commit

Permalink
align styling with selectmultiple and add in value to automcplete
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Dec 19, 2024
1 parent 11d6522 commit 93a08c2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions editor.planx.uk/src/@planx/components/ExternalPortal/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
} from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React, { useState } from "react";
import { FONT_WEIGHT_SEMI_BOLD } from "theme";
import { ModalFooter } from "ui/editor/ModalFooter";
import ModalSection from "ui/editor/ModalSection";
import ModalSectionContent from "ui/editor/ModalSectionContent";
Expand Down Expand Up @@ -45,8 +44,9 @@ type FlowAutocompleteInputProps = AutocompleteProps<
>;

const AutocompleteSubHeader = styled(ListSubheader)(({ theme }) => ({
borderTop: 1,
borderColor: theme.palette.border.main,
border: "none",
borderTop: `1px solid ${theme.palette.border.main}`,
backgroundColor: theme.palette.background.default,
}));

const renderOption: FlowAutocompleteListProps["renderOption"] = (
Expand Down Expand Up @@ -75,22 +75,25 @@ const renderInput: FlowAutocompleteInputProps["renderInput"] = (params) => (

const renderGroup: FlowAutocompleteListProps["renderGroup"] = (params) => (
<>
<AutocompleteSubHeader key={params.children?.toString()}>
<Typography py={1} variant="subtitle2" component="h4">
<AutocompleteSubHeader
disableSticky
key={params.children?.toString()}
aria-label={`${params.group}`}
>
<Typography py={1.5} variant="subtitle2" component="h4">
{params.group}
</Typography>
</AutocompleteSubHeader>
{params.children}
</>
);
const ExternalPortalForm: React.FC<{
id?: string;
flowId?: string;
notes?: string;
handleSubmit?: (val: any) => void;
flows?: Array<Flow>;
tags?: NodeTag[];
}> = ({ id, handleSubmit, flowId = "", flows = [], tags = [], notes = "" }) => {
}> = ({ handleSubmit, flowId = "", flows = [], tags = [], notes = "" }) => {
const [teamArray, setTeamArray] = useState<string[]>([]);

const uniqueTeamArray = [...new Set(flows.map((item) => item.team))];
Expand Down Expand Up @@ -156,6 +159,7 @@ const ExternalPortalForm: React.FC<{
backgroundColor: theme.palette.background.default,
}),
}}
value={flows.find((flow: Flow) => flow.id === formik.values.flowId)}
onChange={(_event, newValue: Flow) => {
formik.setFieldValue("flowId", newValue.id);
}}
Expand Down

0 comments on commit 93a08c2

Please sign in to comment.