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,9 +0,0 @@
/* Custom CSS for dark mode */
@media (prefers-color-scheme: dark) {
.swagger-ui {
filter: invert(85%) hue-rotate(180deg);
}
.swagger-ui .microlight {
filter: invert(100%) hue-rotate(180deg);
}
}

View File

@ -1,15 +1,30 @@
'use client'; 'use client';
import { useEffect } from 'react';
import { useTheme } from 'next-themes';
import SwaggerUI from 'swagger-ui-react'; import SwaggerUI from 'swagger-ui-react';
import 'swagger-ui-react/swagger-ui.css'; import 'swagger-ui-react/swagger-ui.css';
import { OpenAPIV1 } from '@documenso/api/v1/openapi'; 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 = () => { 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} />; return <SwaggerUI spec={OpenAPIV1} displayOperationId={true} />;
}; };

View File

@ -129,3 +129,12 @@
.custom-scrollbar::-webkit-scrollbar-thumb:hover { .custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: rgb(100 116 139 / 0.5); background: rgb(100 116 139 / 0.5);
} }
/* Custom Swagger Dark Theme */
.swagger-dark-theme .swagger-ui {
filter: invert(88%) hue-rotate(180deg);
}
.swagger-dark-theme .swagger-ui .microlight {
filter: invert(100%) hue-rotate(180deg);
}