.
This commit is contained in:
1 parent
04fccbb539
commit
214469eb31
31 files changed
+2345
-708
No files matched your search
+58
-207
@@ -1,10 +1,50 @@
|
||||
import { ChevronRight, MessageSquare, Eye, MoreHorizontal, Download } from 'lucide-react';
|
||||
import { useArticle } from '../hooks/useApi';
|
||||
|
||||
interface MainContentProps {
|
||||
theme: 'light' | 'dark';
|
||||
articleSlug: string | null;
|
||||
}
|
||||
|
||||
export function MainContent({ theme }: MainContentProps) {
|
||||
export function MainContent({ theme, articleSlug }: MainContentProps) {
|
||||
const { data: article, isLoading, error } = useArticle(articleSlug);
|
||||
|
||||
if (!articleSlug) {
|
||||
return (
|
||||
<main className="flex-1 max-w-4xl px-4 sm:px-6 lg:px-12 py-4 sm:py-8">
|
||||
<div className={`text-center py-12 ${
|
||||
theme === 'dark' ? 'text-gray-400' : 'text-gray-600'
|
||||
}`}>
|
||||
<p className="text-lg">Select an article from the sidebar to view its content</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<main className="flex-1 max-w-4xl px-4 sm:px-6 lg:px-12 py-4 sm:py-8">
|
||||
<div className={`text-center py-12 ${
|
||||
theme === 'dark' ? 'text-gray-400' : 'text-gray-600'
|
||||
}`}>
|
||||
<p className="text-lg">Loading article...</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
if (error || !article) {
|
||||
return (
|
||||
<main className="flex-1 max-w-4xl px-4 sm:px-6 lg:px-12 py-4 sm:py-8">
|
||||
<div className={`text-center py-12 ${
|
||||
theme === 'dark' ? 'text-red-400' : 'text-red-600'
|
||||
}`}>
|
||||
<p className="text-lg">Error loading article</p>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<main className="flex-1 max-w-4xl px-4 sm:px-6 lg:px-12 py-4 sm:py-8">
|
||||
{/* Breadcrumb */}
|
||||
@@ -13,7 +53,7 @@ export function MainContent({ theme }: MainContentProps) {
|
||||
}`}>
|
||||
<a href="#" className="hover:text-blue-600">Learn</a>
|
||||
<ChevronRight className="w-3 h-3 sm:w-4 sm:h-4" />
|
||||
<a href="#" className="hover:text-blue-600">OpenAPI</a>
|
||||
<span>{article.title}</span>
|
||||
</div>
|
||||
|
||||
{/* Action buttons */}
|
||||
@@ -40,213 +80,24 @@ export function MainContent({ theme }: MainContentProps) {
|
||||
</div>
|
||||
|
||||
{/* Main heading */}
|
||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl mb-4 sm:mb-6">Kiota API models</h1>
|
||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl mb-4 sm:mb-6">{article.title}</h1>
|
||||
|
||||
{/* Introduction */}
|
||||
<p className={`mb-6 sm:mb-8 leading-relaxed text-sm sm:text-base ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
The primary goal of Kiota's generated models is to enable a developer to easily craft request payloads and get results as high levels objects. These models eliminate the need for developers to define their own types and/or implement serialization/deserialization.
|
||||
</p>
|
||||
|
||||
{/* Section */}
|
||||
<section className="mb-6 sm:mb-8">
|
||||
<h2 className="text-xl sm:text-2xl mb-3 sm:mb-4" id="components-versus-inline-models">
|
||||
Components versus inline models
|
||||
</h2>
|
||||
<p className={`mb-3 sm:mb-4 leading-relaxed text-sm sm:text-base ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
{/* Article metadata */}
|
||||
{article.updatedAt && (
|
||||
<div className={`mb-6 text-xs ${
|
||||
theme === 'dark' ? 'text-gray-500' : 'text-gray-500'
|
||||
}`}>
|
||||
All models declared as components are generated under a <code className={`px-1.5 py-0.5 rounded text-xs sm:text-sm ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#2d2d2d] text-pink-400'
|
||||
: 'bg-gray-100 text-pink-600'
|
||||
}`}>models</code> subnamespace. If models/components are namespaced <code className={`px-1.5 py-0.5 rounded text-xs sm:text-sm ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#2d2d2d] text-pink-400'
|
||||
: 'bg-gray-100 text-pink-600'
|
||||
}`}>components/models</code>, <code className={`px-1.5 py-0.5 rounded text-xs sm:text-sm ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#2d2d2d] text-pink-400'
|
||||
: 'bg-gray-100 text-pink-600'
|
||||
}`}>components/ns1/models</code>, the namespaces are included as subnamespaces of the <code className={`px-1.5 py-0.5 rounded text-xs sm:text-sm ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#2d2d2d] text-pink-400'
|
||||
: 'bg-gray-100 text-pink-600'
|
||||
}`}>models</code> namespace.
|
||||
</p>
|
||||
<p className={`mb-3 sm:mb-4 leading-relaxed text-sm sm:text-base ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
All models declared inline with an operation are generated under the namespace of the operation, next to the request builder that uses it. As a reminder, all request builders are put in namespaces according to the path segment they refer to.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
{/* Section */}
|
||||
<section className="mb-6 sm:mb-8">
|
||||
<h2 className="text-xl sm:text-2xl mb-3 sm:mb-4" id="inheritance">
|
||||
Inheritance
|
||||
</h2>
|
||||
<p className={`mb-3 sm:mb-4 leading-relaxed text-sm sm:text-base ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
Models in an <a href="#" className="text-blue-600 hover:underline">allOf</a> schema declaration inherit from each other. The uppermost type in the collection is the greatest ancestor of the chain.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
{/* Section */}
|
||||
<section className="mb-6 sm:mb-8">
|
||||
<h3 className="text-lg sm:text-xl mb-3 sm:mb-4" id="allof-interpretation">
|
||||
allOf interpretation rules
|
||||
</h3>
|
||||
<p className={`mb-3 sm:mb-4 leading-relaxed text-sm sm:text-base ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
The following table describes how kiota will project any schema with allOf entries when processing an API description:
|
||||
</p>
|
||||
|
||||
{/* Table */}
|
||||
<div className={`border rounded-lg overflow-hidden mt-4 sm:mt-6 ${
|
||||
theme === 'dark' ? 'border-gray-700' : 'border-gray-300'
|
||||
}`}>
|
||||
<button className={`w-full flex items-center justify-center gap-2 py-2 border-b text-xs sm:text-sm ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#0d0d0d] border-gray-700 text-gray-400 hover:text-white'
|
||||
: 'bg-gray-50 border-gray-300 text-gray-600 hover:text-gray-900'
|
||||
}`}>
|
||||
<MoreHorizontal className="w-4 h-4" />
|
||||
<span className="hidden sm:inline">Expand table</span>
|
||||
<span className="sm:hidden">Expand</span>
|
||||
</button>
|
||||
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full">
|
||||
<thead>
|
||||
<tr className={`border-b ${
|
||||
theme === 'dark'
|
||||
? 'bg-[#0d0d0d] border-gray-700'
|
||||
: 'bg-gray-50 border-gray-300'
|
||||
}`}>
|
||||
<th className={`px-2 sm:px-4 py-2 sm:py-3 text-left text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Number of peer properties</span>
|
||||
<span className="sm:hidden">Peer props</span>
|
||||
</th>
|
||||
<th className={`px-2 sm:px-4 py-2 sm:py-3 text-left text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Number of inline schemas</span>
|
||||
<span className="sm:hidden">Inline</span>
|
||||
</th>
|
||||
<th className={`px-2 sm:px-4 py-2 sm:py-3 text-left text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Number referenced schemas</span>
|
||||
<span className="sm:hidden">Referenced</span>
|
||||
</th>
|
||||
<th className={`px-2 sm:px-4 py-2 sm:py-3 text-left text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Total number of schemas</span>
|
||||
<span className="sm:hidden">Total</span>
|
||||
</th>
|
||||
<th className={`px-2 sm:px-4 py-2 sm:py-3 text-left text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>Result</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr className={`border-b ${
|
||||
theme === 'dark' ? 'border-gray-800' : 'border-gray-200'
|
||||
}`}>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Ignored/invalid</span>
|
||||
<span className="sm:hidden">Invalid</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr className={`border-b ${
|
||||
theme === 'dark' ? 'border-gray-800' : 'border-gray-200'
|
||||
}`}>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>1</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>1</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>Unwrapped</td>
|
||||
</tr>
|
||||
<tr className={`border-b ${
|
||||
theme === 'dark' ? 'border-gray-800' : 'border-gray-200'
|
||||
}`}>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>2+</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>2+</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Intersection type</span>
|
||||
<span className="sm:hidden">Intersection</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr className={`border-b ${
|
||||
theme === 'dark' ? 'border-gray-800' : 'border-gray-200'
|
||||
}`}>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>1+</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>any</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>0</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>any</td>
|
||||
<td className={`px-2 sm:px-4 py-2 sm:py-3 text-xs sm:text-sm ${
|
||||
theme === 'dark' ? 'text-gray-300' : 'text-gray-700'
|
||||
}`}>
|
||||
<span className="hidden sm:inline">Inline object</span>
|
||||
<span className="sm:hidden">Inline obj</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
Last updated: {new Date(article.updatedAt).toLocaleDateString()}
|
||||
</div>
|
||||
</section>
|
||||
)}
|
||||
|
||||
{/* Article content */}
|
||||
<div
|
||||
className={`mb-6 sm:mb-8 leading-relaxed text-sm sm:text-base prose max-w-none ${
|
||||
theme === 'dark' ? 'text-gray-300 prose-invert' : 'text-gray-700'
|
||||
}`}
|
||||
dangerouslySetInnerHTML={{ __html: article.content || '' }}
|
||||
/>
|
||||
|
||||
{/* Footer */}
|
||||
<div className={`mt-8 sm:mt-12 pt-4 sm:pt-6 border-t ${
|
||||
@@ -261,4 +112,4 @@ export function MainContent({ theme }: MainContentProps) {
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user