mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-15 11:57:00 +00:00
first pass restyle of auth methods and rules
This commit is contained in:
38
src/components/resource-policy/PolicyAuthStackSection.tsx
Normal file
38
src/components/resource-policy/PolicyAuthStackSection.tsx
Normal file
@@ -0,0 +1,38 @@
|
||||
"use client";
|
||||
|
||||
import { type UseFormReturn } from "react-hook-form";
|
||||
import type { PolicyFormValues } from ".";
|
||||
import { PolicyAuthStackSectionCreate } from "./PolicyAuthStackSectionCreate";
|
||||
import { PolicyAuthStackSectionEdit } from "./PolicyAuthStackSectionEdit";
|
||||
|
||||
type PolicyAuthStackSectionEditProps = {
|
||||
mode: "edit";
|
||||
orgId: string;
|
||||
allIdps: { id: number; text: string }[];
|
||||
emailEnabled: boolean;
|
||||
readonly?: boolean;
|
||||
resourceId?: number;
|
||||
};
|
||||
|
||||
type PolicyAuthStackSectionCreateProps = {
|
||||
mode: "create";
|
||||
form: UseFormReturn<PolicyFormValues, any, any>;
|
||||
orgId: string;
|
||||
allIdps: { id: number; text: string }[];
|
||||
allRoles: { id: string; text: string }[];
|
||||
allUsers: { id: string; text: string }[];
|
||||
emailEnabled: boolean;
|
||||
};
|
||||
|
||||
export type PolicyAuthStackSectionProps =
|
||||
| PolicyAuthStackSectionEditProps
|
||||
| PolicyAuthStackSectionCreateProps;
|
||||
|
||||
export function PolicyAuthStackSection(props: PolicyAuthStackSectionProps) {
|
||||
if (props.mode === "create") {
|
||||
const { mode: _, ...createProps } = props;
|
||||
return <PolicyAuthStackSectionCreate {...createProps} />;
|
||||
}
|
||||
const { mode: _, ...editProps } = props;
|
||||
return <PolicyAuthStackSectionEdit {...editProps} />;
|
||||
}
|
||||
Reference in New Issue
Block a user