Skip to content

Commit

Permalink
back to tabs, chucked sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
catosaurusrex2003 committed Feb 4, 2025
1 parent b834a1b commit 4f3d60b
Show file tree
Hide file tree
Showing 5 changed files with 298 additions and 302 deletions.
245 changes: 119 additions & 126 deletions library/src/components/Payload/Conditions/Conditions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,140 +15,133 @@ export const Conditions = ({
dependentSchemas,
}: ConditionsProps) => {
return (
<>
<p
className={`text-sm font-semibold text-gray-900 bg-gray-400 p-2 rounded-t w-min`}
>
Conditions
</p>
<div className={`space-y-2 bg-blue-100 border rounded rounded-tl-none p-4`}>
{schema.oneOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Can be <strong>One Of</strong> the following:
</h5>
{schema
.oneOf()
?.map((s, idx) => (
<Payload
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
))}
</div>
)}

{schema.anyOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Can be <strong>Any Of</strong> the following:
</h5>
{schema
.anyOf()
?.map((s, idx) => (
<Payload
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
))}
</div>
)}

{schema.allOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Must consist <strong>All Of</strong> the following:
</h5>
{schema
.allOf()
?.map((s, idx) => (
<Payload
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
))}
</div>
)}

{schema.not() && (
<Payload
schema={schema.not()}
schemaName="Can NOT adhere to:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.propertyNames() && (
<Payload
schema={schema.propertyNames()}
schemaName="Property names must adhere to:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.contains() && (
<Payload
schema={schema.contains()}
schemaName="Array must contain at least one of:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.if() && (
<div className="">
{schema.if() && (
<div className={`space-y-2 bg-blue-100 border rounded rounded-tl-none p-4`}>
{schema.oneOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Can be <strong>One Of</strong> the following:
</h5>
{schema
.oneOf()
?.map((s, idx) => (
<Payload
schema={schema.if()}
schemaName="If schema adheres to:"
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
)}
{schema.then() && (
))}
</div>
)}

{schema.anyOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Can be <strong>Any Of</strong> the following:
</h5>
{schema
.anyOf()
?.map((s, idx) => (
<Payload
schema={schema.then()}
schemaName="Then must adhere to:"
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
)}
{schema.else() && (
))}
</div>
)}

{schema.allOf()?.length && (
<div className="">
<h5 className="text-sm font-semibold text-gray-700 mb-2">
Must consist <strong>All Of</strong> the following:
</h5>
{schema
.allOf()
?.map((s, idx) => (
<Payload
schema={schema.else()}
schemaName="Otherwise:"
key={idx}
schema={s}
schemaName={SchemaHelpers.applicatorSchemaName(
idx,
'',
'',
s.title() ?? s.id(),
)}
recursionCounter={recursionCounter + 1}
/>
)}
</div>
)}

{dependentSchemas && (
<Payload
schema={dependentSchemas}
schemaName="Dependent schemas:"
recursionCounter={recursionCounter + 1}
/>
)}
</div>
</>
))}
</div>
)}

{schema.not() && (
<Payload
schema={schema.not()}
schemaName="Can NOT adhere to:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.propertyNames() && (
<Payload
schema={schema.propertyNames()}
schemaName="Property names must adhere to:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.contains() && (
<Payload
schema={schema.contains()}
schemaName="Array must contain at least one of:"
recursionCounter={recursionCounter + 1}
/>
)}

{schema.if() && (
<div className="">
{schema.if() && (
<Payload
schema={schema.if()}
schemaName="If schema adheres to:"
recursionCounter={recursionCounter + 1}
/>
)}
{schema.then() && (
<Payload
schema={schema.then()}
schemaName="Then must adhere to:"
recursionCounter={recursionCounter + 1}
/>
)}
{schema.else() && (
<Payload
schema={schema.else()}
schemaName="Otherwise:"
recursionCounter={recursionCounter + 1}
/>
)}
</div>
)}

{dependentSchemas && (
<Payload
schema={dependentSchemas}
schemaName="Dependent schemas:"
recursionCounter={recursionCounter + 1}
/>
)}
</div>
);
};
Loading

0 comments on commit 4f3d60b

Please sign in to comment.