Skip to content

Commit 5e87d53

Browse files
committed
Improved the UI a bit
1 parent 95dde44 commit 5e87d53

File tree

1 file changed

+48
-27
lines changed

1 file changed

+48
-27
lines changed

index.html

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<title>SQL to Mermaid ER Diagram</title>
88
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" />
910
<style>
1011
body {
1112
font-family: 'Inter', sans-serif;
@@ -14,16 +15,17 @@
1415
display: flex;
1516
flex-direction: column;
1617
height: 100vh;
17-
background-color: #f4f4f8;
18+
background-color: #f0f0f5;
1819
}
1920

2021
header {
21-
background-color: #4CAF50;
22+
background-color: #3c40c6;
2223
color: white;
23-
padding: 10px 20px;
24+
padding: 15px;
2425
text-align: center;
25-
font-size: 1.5rem;
26+
font-size: 1.8rem;
2627
font-weight: 600;
28+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
2729
}
2830

2931
main {
@@ -34,57 +36,78 @@
3436
.left-panel {
3537
width: 40%;
3638
padding: 20px;
37-
background: #fff;
38-
box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
39+
background: #ffffff;
40+
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
41+
}
42+
43+
.left-panel h2 {
44+
color: #333;
45+
font-size: 1.5rem;
46+
margin-bottom: 10px;
3947
}
4048

4149
.left-panel textarea {
4250
width: 100%;
43-
height: 80%;
44-
padding: 10px;
51+
height: 75%;
52+
padding: 12px;
4553
font-size: 1rem;
46-
border: 1px solid #ccc;
47-
border-radius: 5px;
54+
border: 1px solid #ddd;
55+
border-radius: 8px;
4856
resize: none;
57+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
4958
}
5059

5160
.left-panel button {
52-
margin-top: 10px;
53-
padding: 10px 20px;
54-
background-color: #4CAF50;
61+
margin-top: 12px;
62+
padding: 10px 25px;
63+
background-color: #3c40c6;
5564
color: white;
5665
border: none;
57-
border-radius: 5px;
66+
border-radius: 8px;
5867
cursor: pointer;
5968
font-size: 1rem;
69+
transition: background-color 0.3s ease;
6070
}
6171

6272
.left-panel button:hover {
63-
background-color: #45a049;
73+
background-color: #575fcf;
6474
}
6575

6676
.right-panel {
6777
flex: 1;
6878
padding: 20px;
79+
background: #f8f9fa;
80+
box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
81+
}
82+
83+
.right-panel h2 {
84+
color: #333;
85+
font-size: 1.5rem;
86+
margin-bottom: 10px;
6987
}
7088

7189
.right-panel pre {
72-
background: #2d2d2d;
73-
color: #f4f4f8;
90+
background: #1e272e;
91+
color: #d2dae2;
7492
padding: 20px;
75-
border-radius: 5px;
93+
border-radius: 8px;
7694
font-size: 1rem;
7795
overflow: auto;
78-
height: 100%;
96+
height: calc(100% - 40px);
97+
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
7998
}
99+
100+
101+
102+
80103
</style>
81104
</head>
82105

83106
<body>
84107
<header>SQL to Mermaid ER Diagram</header>
85108
<main>
86109
<div class="left-panel">
87-
<h2>SQL Query</h2>
110+
<h2>PostgreSQL Query</h2>
88111
<textarea id="sqlInput" placeholder="Type your SQL query here..."></textarea>
89112
<button id="runBtn">Run</button>
90113
</div>
@@ -103,13 +126,15 @@ <h2>Mermaid Diagram</h2>
103126
string deliveryAddress
104127
}
105128
customer ||--o{ order : places
106-
</pre>
129+
</pre>
107130
</div>
108131
</main>
109132

133+
134+
<a class="github-fork-ribbon" href="https://github.com/tusharad/sql2er" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a>
135+
110136
<script type="module">
111137
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
112-
113138
mermaid.initialize({ startOnLoad: true });
114139

115140
document.getElementById('runBtn').addEventListener('click', () => {
@@ -121,12 +146,8 @@ <h2>Mermaid Diagram</h2>
121146
mermaid.run();
122147
});
123148

124-
// Mock function to simulate SQL to Mermaid ER Diagram conversion
125149
function generate(sqlQuery) {
126-
// Replace this with the actual logic for SQL parsing and Mermaid ER generation
127-
const res = echo(sqlQuery);
128-
console.log("got res:", res);
129-
return res;
150+
return `Mocked Diagram: ${sqlQuery}`;
130151
}
131152

132153
import { WASI } from 'https://cdn.jsdelivr.net/npm/@bjorn3/browser_wasi_shim@0.3.0/+esm'

0 commit comments

Comments
 (0)