chore: updated styling

Signed-off-by: Adithya Krishna <aadithya794@gmail.com>
This commit is contained in:
Adithya Krishna
2024-03-13 13:24:09 +05:30
parent 025af6e9f4
commit cc483016d8
3 changed files with 28 additions and 13 deletions

View File

@@ -1,15 +1,30 @@
'use client';
import { useEffect } from 'react';
import { useTheme } from 'next-themes';
import SwaggerUI from 'swagger-ui-react';
import 'swagger-ui-react/swagger-ui.css';
import { OpenAPIV1 } from '@documenso/api/v1/openapi';
// Custom Dark Mode CSS for the Swagger UI
// eslint-disable-next-line prettier/prettier
import './api-documentation.css';
export const OpenApiDocsPage = () => {
const { theme } = useTheme();
useEffect(() => {
const body = document.body;
if (theme === 'dark') {
body.classList.add('swagger-dark-theme');
} else {
body.classList.remove('swagger-dark-theme');
}
return () => {
body.classList.remove('swagger-dark-theme');
};
}, [theme]);
return <SwaggerUI spec={OpenAPIV1} displayOperationId={true} />;
};