Skip to content

Commit 2410ed8

Browse files
committed
feat: Enhance UI components and layout
- Added Flowbite and Flowbite-React for improved UI components. - Updated App.css to set a dark background for the body. - Refactored App.tsx to use MainLayout for better structure. - Improved TerminalView with dynamic colors from appConfig. - Simplified Button component and removed unused buttonVariants. - Updated Navbar01 to use new Button component and dynamic colors. - Introduced COLORS configuration for consistent theming. - Enhanced Dashboard with responsive table and styling. - Updated SchemaPage to utilize new Button component and dynamic styles. - Improved TestDetailsPane layout and integrated new Button component. - Created Footer component for consistent footer layout. - Added main-layout component to encapsulate the overall layout. - Introduced Button.module.scss for button styling.
1 parent af1edb1 commit 2410ed8

File tree

19 files changed

+1008
-218
lines changed

19 files changed

+1008
-218
lines changed

frontend/package-lock.json

Lines changed: 685 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
"axios": "^1.11.0",
2121
"class-variance-authority": "^0.7.1",
2222
"clsx": "^2.1.1",
23+
"flowbite": "^3.1.2",
24+
"flowbite-react": "^0.12.9",
2325
"js-yaml": "^4.1.0",
2426
"lucide-react": "^0.542.0",
2527
"openapi-types": "^12.1.3",
@@ -28,6 +30,7 @@
2830
"react-hook-form": "^7.62.0",
2931
"react-hot-toast": "^2.6.0",
3032
"socket.io-client": "^4.8.1",
33+
"styled-components": "^6.1.19",
3134
"tailwind-merge": "^3.3.1",
3235
"xterm": "^5.3.0",
3336
"xterm-addon-fit": "^0.8.0",

frontend/src/App.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
.m{
1+
.m {
22
border: 2px solid red;
3+
}
4+
5+
body {
6+
background: #020618;
37
}

frontend/src/App.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ import { LoadingProvider } from './context/LoadingProvider'
55
import { OpenApiProvider } from './context/openApiProvider'
66
import { TerminalProvider } from './context/TerminalProvider'
77
import { TestRunnerProvider } from './context/TestRunnerProvider'
8-
import Dashboard from './features/dashboard'
9-
import SchemaPage from './features/schema-input'
10-
import TestDetailsPane from './features/test-details'
11-
import TestRunner from './features/test-runner'
8+
import MainLayout from './layout/main-layout'
129
function App() {
1310
return (
1411
<>
@@ -17,11 +14,7 @@ function App() {
1714
<FileProvider>
1815
<TerminalProvider>
1916
<LoadingProvider>
20-
<Navbar01 />
21-
<SchemaPage />
22-
<TestDetailsPane />
23-
<TestRunner />
24-
<Dashboard />
17+
<MainLayout Navbar={Navbar01} />
2518
</LoadingProvider>
2619
</TerminalProvider>
2720
</FileProvider>

frontend/src/components/TerminalView.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Terminal } from "xterm";
33
import "xterm/css/xterm.css";
44
import { useWebSocket } from "../hooks/useWebSocket";
55
import { useTerminal } from "@/hooks/useTerminal";
6+
import { COLORS } from "@/config/appConfig";
67

78
export default function TerminalView() {
89
const terminalRef = useRef<HTMLDivElement | null>(null);
@@ -20,8 +21,8 @@ export default function TerminalView() {
2021
fontFamily: "'Fira Code', monospace",
2122
fontSize: 14,
2223
theme: {
23-
background: "#0f0f1f", // dark background
24-
foreground: "#00ffff", // neon cyan text
24+
background: COLORS.primary, // dark background
25+
foreground: COLORS.text, // neon cyan text
2526
cursor: "#00ffff", // neon cursor
2627
}
2728
});
@@ -54,13 +55,12 @@ export default function TerminalView() {
5455
}, [messages, isConnected, error]);
5556

5657
return (
57-
<div
58+
<div className="px-4 py-2"
5859
ref={terminalRef}
5960
style={{
6061
width: "100%",
6162
height: "300px",
62-
backgroundColor: "#1e1e1e",
63-
borderRadius: "8px",
63+
backgroundColor: COLORS.background,
6464
overflow: "hidden",
6565
}}
6666
/>
Lines changed: 10 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
1-
import * as React from "react"
2-
import { Slot } from "@radix-ui/react-slot"
3-
import { type VariantProps } from "class-variance-authority"
4-
5-
import { cn } from "@/lib/utils"
6-
import { buttonVariants } from "./button/buttonVariants"
7-
8-
9-
function Button({
10-
className,
11-
variant,
12-
size,
13-
asChild = false,
14-
...props
15-
}: React.ComponentProps<"button"> &
16-
VariantProps<typeof buttonVariants> & {
17-
asChild?: boolean
18-
}) {
19-
const Comp = asChild ? Slot : "button"
1+
import styles from '../../styles/Button.module.scss';
2+
import type { ReactNode } from 'react';
3+
const Button = ({ variant = 'primary', children, ...props }: { variant?: string, children: ReactNode }) => {
4+
const className = styles[variant];
205

216
return (
22-
<Comp
23-
data-slot="button"
24-
className={cn(buttonVariants({ variant, size, className }))}
25-
{...props}
26-
/>
27-
)
28-
}
29-
30-
export { Button }
7+
<button className={`${className}`} {...props}>
8+
{children}
9+
</button>
10+
);
11+
};
12+
export default Button;

frontend/src/components/ui/button/buttonVariants.ts

Lines changed: 0 additions & 32 deletions
This file was deleted.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { COLORS } from '@/config/appConfig';
2+
import React from 'react';
3+
4+
const Footer: React.FC = () => {
5+
return (
6+
7+
8+
<footer className="rounded-lg shadow-sm m-4" style={{ background: COLORS.background }}>
9+
<div className="w-full max-w-screen-xl mx-auto p-4 md:py-8">
10+
<div className="sm:flex sm:items-center sm:justify-between">
11+
<a href="#" className="flex items-center mb-4 sm:mb-0 space-x-3 rtl:space-x-reverse">
12+
<img src="/favicon-16x16.png" className="h-8" alt="Website Logo" />
13+
<span className="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">OpenAPI Tool</span>
14+
</a>
15+
<ul className="flex flex-wrap items-center mb-6 text-sm font-medium text-gray-500 sm:mb-0 dark:text-gray-400">
16+
<li>
17+
<a href="#" className="hover:underline me-4 md:me-6">About Developer</a>
18+
</li>
19+
<li>
20+
<a href="#" className="hover:underline me-4 md:me-6">GitHub Fork</a>
21+
</li>
22+
<li>
23+
<a href="#" className="hover:underline">Contact</a>
24+
</li>
25+
</ul>
26+
</div>
27+
<hr className="my-6 border-gray-200 sm:mx-auto dark:border-gray-700 lg:my-8" />
28+
<span className="block text-sm text-gray-500 sm:text-center dark:text-gray-400"> <a href="#" className="hover:underline">Rishabh Jain</a> made with Love</span>
29+
</div>
30+
</footer>
31+
32+
33+
);
34+
};
35+
36+
export default Footer;

frontend/src/components/ui/navbar.tsx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
import { COLORS } from '@/config/appConfig';
12
import React from 'react';
3+
import Button from './button';
24

35
const Navbar01: React.FC = () => {
46
return (
5-
<nav className="bg-white dark:bg-gray-900 w-full z-20 top-0 start-0 border-b border-gray-200 dark:border-gray-600">
7+
<nav className={`w-full z-20 top-0 start-0 border-b`} style={{ backgroundColor: COLORS.primary }}>
68
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
79
<a href="/" className="flex items-center space-x-3 rtl:space-x-reverse">
810
<img src="/favicon-16x16.png" className="h-8" alt="Website Logo" />
9-
<span className="self-center text-xl font-semibold whitespace-nowrap dark:text-white">OpenAPI Tester</span>
11+
<span className="self-center text-xl font-semibold whitespace-nowrap text-white">OpenAPI Tool</span>
1012
</a>
1113
<div className="flex md:order-2 space-x-3 md:space-x-0 rtl:space-x-reverse">
12-
<button type="button" className="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">
13-
14-
<a href="https://github.com/eddyseed/" target='_blank'>Contact</a>
15-
</button>
14+
<Button variant="secondary">Contact Us</Button>
1615
<button data-collapse-toggle="navbar-sticky" type="button" className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600" aria-controls="navbar-sticky" aria-expanded="false">
1716
<span className="sr-only">Open main menu</span>
1817
<svg className="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
@@ -21,18 +20,29 @@ const Navbar01: React.FC = () => {
2120
</button>
2221
</div>
2322
<div className="items-center justify-between hidden w-full md:flex md:w-auto md:order-1" id="navbar-sticky">
24-
<ul className="flex flex-col p-4 md:p-0 mt-4 font-medium border border-gray-100 rounded-lg bg-gray-50 md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0 md:bg-white dark:bg-gray-800 md:dark:bg-gray-900 dark:border-gray-700">
23+
<ul className="flex flex-col p-4 md:p-0 mt-4 font-medium border rounded-lg md:space-x-8 rtl:space-x-reverse md:flex-row md:mt-0 md:border-0">
2524
<li>
26-
<a href="#" className="block py-2 px-3 text-white bg-blue-700 rounded-sm md:bg-transparent md:text-blue-700 md:p-0 md:dark:text-blue-500" aria-current="page">Home</a>
25+
<a href="#" className="block py-2 px-3 rounded-sm md:p-0" aria-current="page" style={{
26+
color: COLORS.text
27+
}}>Home</a>
2728
</li>
2829
<li>
29-
<a href="#TEST_DETAILS_PANE" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">Test Details</a>
30+
<a href="#TEST_DETAILS_PANE" className="block py-2 px-3 rounded-sm md:p-0" style={{
31+
color: COLORS.secondary,
32+
}} onMouseEnter={(e) => (e.currentTarget.style.color = COLORS.text)}
33+
onMouseLeave={(e) => (e.currentTarget.style.color = COLORS.secondary)}>Test Details</a>
3034
</li>
3135
<li>
32-
<a href="#TERMINAL" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">Shell Logs</a>
36+
<a href="#TERMINAL" className="block py-2 px-3 rounded-sm md:p-0" style={{
37+
color: COLORS.secondary,
38+
}} onMouseEnter={(e) => (e.currentTarget.style.color = COLORS.text)}
39+
onMouseLeave={(e) => (e.currentTarget.style.color = COLORS.secondary)}>Shell Logs</a>
3340
</li>
3441
<li>
35-
<a href="#DASHBOARD" className="block py-2 px-3 text-gray-900 rounded-sm hover:bg-gray-100 md:hover:bg-transparent md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:text-white dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent dark:border-gray-700">Dashboard</a>
42+
<a href="#DASHBOARD" className="block py-2 px-3 rounded-sm md:p-0" style={{
43+
color: COLORS.secondary,
44+
}} onMouseEnter={(e) => (e.currentTarget.style.color = COLORS.text)}
45+
onMouseLeave={(e) => (e.currentTarget.style.color = COLORS.secondary)}>Dashboard</a>
3646
</li>
3747
</ul>
3848
</div>

frontend/src/config/appConfig.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export const COLORS = {
2+
primary: '#0D1B1E',
3+
background: '#0D1117',
4+
secondary: '#6B8F71',
5+
text: '#C3DBC5',
6+
text_hover: '#F51AA4'
7+
}
8+
export const URLS = {
9+
10+
}

0 commit comments

Comments
 (0)