Abmacode12 commited on
Commit
6a662eb
·
verified ·
1 Parent(s): 6e813d0

<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.47.0/min/vs/loader.min.js"></script>

Browse files
Files changed (6) hide show
  1. README.md +8 -5
  2. components/footer.js +123 -0
  3. components/navbar.js +105 -0
  4. index.html +101 -19
  5. script.js +23 -0
  6. style.css +19 -18
README.md CHANGED
@@ -1,10 +1,13 @@
1
  ---
2
- title: Codecanvas Monaco Magic Editor
3
- emoji: 🏢
4
- colorFrom: red
5
- colorTo: green
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
1
  ---
2
+ title: CodeCanvas - Monaco Magic Editor 🌟
3
+ colorFrom: yellow
4
+ colorTo: gray
5
+ emoji: 🐳
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite-v3
10
  ---
11
 
12
+ # Welcome to your new DeepSite project!
13
+ This project was created with [DeepSite](https://huggingface.co/deepsite).
components/footer.js ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomFooter extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ width: 100%;
9
+ background-color: #1e293b;
10
+ color: #e2e8f0;
11
+ padding: 2rem 1rem;
12
+ margin-top: 2rem;
13
+ }
14
+ .footer-container {
15
+ max-width: 1280px;
16
+ margin: 0 auto;
17
+ }
18
+ .footer-grid {
19
+ display: grid;
20
+ grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
21
+ gap: 2rem;
22
+ }
23
+ .footer-column h3 {
24
+ color: white;
25
+ font-weight: 600;
26
+ margin-bottom: 1rem;
27
+ font-size: 1.125rem;
28
+ }
29
+ .footer-links {
30
+ display: flex;
31
+ flex-direction: column;
32
+ gap: 0.5rem;
33
+ }
34
+ .footer-link {
35
+ color: #94a3b8;
36
+ transition: color 0.2s;
37
+ }
38
+ .footer-link:hover {
39
+ color: #60a5fa;
40
+ }
41
+ .footer-bottom {
42
+ margin-top: 2rem;
43
+ padding-top: 1rem;
44
+ border-top: 1px solid #334155;
45
+ display: flex;
46
+ justify-content: space-between;
47
+ align-items: center;
48
+ }
49
+ .social-links {
50
+ display: flex;
51
+ gap: 1rem;
52
+ }
53
+ .social-link {
54
+ color: #94a3b8;
55
+ transition: color 0.2s;
56
+ }
57
+ .social-link:hover {
58
+ color: #60a5fa;
59
+ }
60
+ @media (max-width: 768px) {
61
+ .footer-bottom {
62
+ flex-direction: column;
63
+ gap: 1rem;
64
+ text-align: center;
65
+ }
66
+ }
67
+ </style>
68
+ <div class="footer-container">
69
+ <div class="footer-grid">
70
+ <div class="footer-column">
71
+ <h3>Product</h3>
72
+ <div class="footer-links">
73
+ <a href="#" class="footer-link">Features</a>
74
+ <a href="#" class="footer-link">Pricing</a>
75
+ <a href="#" class="footer-link">Documentation</a>
76
+ <a href="#" class="footer-link">Changelog</a>
77
+ </div>
78
+ </div>
79
+ <div class="footer-column">
80
+ <h3>Resources</h3>
81
+ <div class="footer-links">
82
+ <a href="#" class="footer-link">Templates</a>
83
+ <a href="#" class="footer-link">Examples</a>
84
+ <a href="#" class="footer-link">API Reference</a>
85
+ <a href="#" class="footer-link">Community</a>
86
+ </div>
87
+ </div>
88
+ <div class="footer-column">
89
+ <h3>Company</h3>
90
+ <div class="footer-links">
91
+ <a href="#" class="footer-link">About</a>
92
+ <a href="#" class="footer-link">Blog</a>
93
+ <a href="#" class="footer-link">Careers</a>
94
+ <a href="#" class="footer-link">Contact</a>
95
+ </div>
96
+ </div>
97
+ <div class="footer-column">
98
+ <h3>Legal</h3>
99
+ <div class="footer-links">
100
+ <a href="#" class="footer-link">Privacy</a>
101
+ <a href="#" class="footer-link">Terms</a>
102
+ <a href="#" class="footer-link">Security</a>
103
+ <a href="#" class="footer-link">Cookies</a>
104
+ </div>
105
+ </div>
106
+ </div>
107
+ <div class="footer-bottom">
108
+ <div>
109
+ © 2023 CodeCanvas. All rights reserved.
110
+ </div>
111
+ <div class="social-links">
112
+ <a href="#" class="social-link"><i data-feather="twitter"></i></a>
113
+ <a href="#" class="social-link"><i data-feather="github"></i></a>
114
+ <a href="#" class="social-link"><i data-feather="linkedin"></i></a>
115
+ <a href="#" class="social-link"><i data-feather="youtube"></i></a>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ `;
120
+ feather.replace({ shadowRoot: this.shadowRoot });
121
+ }
122
+ }
123
+ customElements.define('custom-footer', CustomFooter);
components/navbar.js ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ class CustomNavbar extends HTMLElement {
2
+ connectedCallback() {
3
+ this.attachShadow({ mode: 'open' });
4
+ this.shadowRoot.innerHTML = `
5
+ <style>
6
+ :host {
7
+ display: block;
8
+ width: 100%;
9
+ position: sticky;
10
+ top: 0;
11
+ z-index: 50;
12
+ }
13
+ nav {
14
+ background-color: #1e293b;
15
+ color: white;
16
+ padding: 0.75rem 1rem;
17
+ }
18
+ .nav-container {
19
+ max-width: 1280px;
20
+ margin: 0 auto;
21
+ display: flex;
22
+ justify-content: space-between;
23
+ align-items: center;
24
+ }
25
+ .logo {
26
+ display: flex;
27
+ align-items: center;
28
+ gap: 0.5rem;
29
+ font-weight: 600;
30
+ font-size: 1.25rem;
31
+ }
32
+ .logo-icon {
33
+ color: #60a5fa;
34
+ }
35
+ .nav-links {
36
+ display: flex;
37
+ gap: 1.5rem;
38
+ }
39
+ .nav-link {
40
+ color: #e2e8f0;
41
+ transition: color 0.2s;
42
+ }
43
+ .nav-link:hover {
44
+ color: #60a5fa;
45
+ }
46
+ .action-buttons {
47
+ display: flex;
48
+ gap: 0.75rem;
49
+ }
50
+ .btn {
51
+ padding: 0.5rem 1rem;
52
+ border-radius: 0.375rem;
53
+ font-weight: 500;
54
+ transition: all 0.2s;
55
+ }
56
+ .btn-primary {
57
+ background-color: #3b82f6;
58
+ color: white;
59
+ }
60
+ .btn-primary:hover {
61
+ background-color: #2563eb;
62
+ }
63
+ .btn-outline {
64
+ border: 1px solid #64748b;
65
+ color: white;
66
+ }
67
+ .btn-outline:hover {
68
+ border-color: #3b82f6;
69
+ color: #3b82f6;
70
+ }
71
+ @media (max-width: 768px) {
72
+ .nav-links {
73
+ display: none;
74
+ }
75
+ }
76
+ </style>
77
+ <nav>
78
+ <div class="nav-container">
79
+ <a href="/" class="logo">
80
+ <i data-feather="code" class="logo-icon"></i>
81
+ CodeCanvas
82
+ </a>
83
+ <div class="nav-links">
84
+ <a href="#" class="nav-link">Features</a>
85
+ <a href="#" class="nav-link">Templates</a>
86
+ <a href="#" class="nav-link">Docs</a>
87
+ <a href="#" class="nav-link">Pricing</a>
88
+ </div>
89
+ <div class="action-buttons">
90
+ <button id="run-code-btn" class="btn btn-primary">
91
+ <i data-feather="play" class="w-4 h-4 mr-1"></i>
92
+ Run Code
93
+ </button>
94
+ <button class="btn btn-outline">
95
+ <i data-feather="log-in" class="w-4 h-4 mr-1"></i>
96
+ Sign In
97
+ </button>
98
+ </div>
99
+ </div>
100
+ </nav>
101
+ `;
102
+ feather.replace({ shadowRoot: this.shadowRoot });
103
+ }
104
+ }
105
+ customElements.define('custom-navbar', CustomNavbar);
index.html CHANGED
@@ -1,19 +1,101 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>CodeCanvas - Monaco Magic Editor</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.47.0/min/vs/loader.min.js"></script>
12
+ </head>
13
+ <body class="bg-gray-100 min-h-screen">
14
+ <custom-navbar></custom-navbar>
15
+
16
+ <div class="container mx-auto px-4 py-8">
17
+ <div class="flex flex-col lg:flex-row gap-6">
18
+ <!-- Editor Panel -->
19
+ <div class="flex-1">
20
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden">
21
+ <div class="flex justify-between items-center bg-gray-800 text-white px-4 py-3">
22
+ <div class="flex items-center space-x-2">
23
+ <i data-feather="code" class="w-5 h-5"></i>
24
+ <h2 class="font-semibold">Code Editor</h2>
25
+ </div>
26
+ <div class="flex space-x-3">
27
+ <button class="hover:text-blue-400 transition-colors">
28
+ <i data-feather="copy" class="w-5 h-5"></i>
29
+ </button>
30
+ <button class="hover:text-blue-400 transition-colors">
31
+ <i data-feather="download" class="w-5 h-5"></i>
32
+ </button>
33
+ <button class="hover:text-blue-400 transition-colors">
34
+ <i data-feather="settings" class="w-5 h-5"></i>
35
+ </button>
36
+ </div>
37
+ </div>
38
+ <div id="editor-container" class="h-96"></div>
39
+ </div>
40
+ </div>
41
+
42
+ <!-- Output Panel -->
43
+ <div class="flex-1">
44
+ <div class="bg-white rounded-xl shadow-lg overflow-hidden">
45
+ <div class="flex justify-between items-center bg-gray-800 text-white px-4 py-3">
46
+ <div class="flex items-center space-x-2">
47
+ <i data-feather="monitor" class="w-5 h-5"></i>
48
+ <h2 class="font-semibold">Output</h2>
49
+ </div>
50
+ <div class="flex space-x-3">
51
+ <button class="hover:text-blue-400 transition-colors">
52
+ <i data-feather="refresh-cw" class="w-5 h-5"></i>
53
+ </button>
54
+ <button class="hover:text-blue-400 transition-colors">
55
+ <i data-feather="maximize" class="w-5 h-5"></i>
56
+ </button>
57
+ </div>
58
+ </div>
59
+ <div id="output-container" class="h-96 p-4 bg-gray-50 overflow-auto">
60
+ <div class="text-gray-500 text-center py-20">Your output will appear here...</div>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ </div>
65
+ </div>
66
+
67
+ <custom-footer></custom-footer>
68
+
69
+ <script src="components/navbar.js"></script>
70
+ <script src="components/footer.js"></script>
71
+ <script src="script.js"></script>
72
+ <script>
73
+ feather.replace();
74
+
75
+ // Initialize Monaco Editor
76
+ require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.47.0/min/vs' }});
77
+ require(['vs/editor/editor.main'], function() {
78
+ const editor = monaco.editor.create(document.getElementById('editor-container'), {
79
+ value: '// Welcome to CodeCanvas!\n// Start coding here...\n\nfunction helloWorld() {\n console.log("Hello, world!");\n}\n\nhelloWorld();',
80
+ language: 'javascript',
81
+ theme: 'vs-dark',
82
+ automaticLayout: true,
83
+ minimap: { enabled: true }
84
+ });
85
+
86
+ // Run code button functionality
87
+ document.querySelector('#run-code-btn').addEventListener('click', function() {
88
+ const code = editor.getValue();
89
+ try {
90
+ // This is just a demo - in production you'd want to use a safer eval alternative
91
+ const output = new Function(code)();
92
+ document.getElementById('output-container').innerHTML = `<pre class="text-gray-800">${output || "Code executed successfully (no output)"}</pre>`;
93
+ } catch (error) {
94
+ document.getElementById('output-container').innerHTML = `<pre class="text-red-600">Error: ${error.message}</pre>`;
95
+ }
96
+ });
97
+ });
98
+ </script>
99
+ <script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
100
+ </body>
101
+ </html>
script.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Shared functionality across pages
2
+ document.addEventListener('DOMContentLoaded', () => {
3
+ // Theme toggle functionality
4
+ const themeToggle = document.getElementById('theme-toggle');
5
+ if (themeToggle) {
6
+ themeToggle.addEventListener('click', () => {
7
+ document.documentElement.classList.toggle('dark');
8
+ const isDark = document.documentElement.classList.contains('dark');
9
+ localStorage.setItem('darkMode', isDark);
10
+ });
11
+ }
12
+
13
+ // Initialize dark mode preference
14
+ if (localStorage.getItem('darkMode') === 'true') {
15
+ document.documentElement.classList.add('dark');
16
+ }
17
+
18
+ // Tooltip initialization
19
+ const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'));
20
+ tooltipTriggerList.map((tooltipTriggerEl) => {
21
+ return new bootstrap.Tooltip(tooltipTriggerEl);
22
+ });
23
+ });
style.css CHANGED
@@ -1,28 +1,29 @@
 
 
1
  body {
2
- padding: 2rem;
3
- font-family: -apple-system, BlinkMacSystemFont, "Arial", sans-serif;
4
  }
5
 
6
- h1 {
7
- font-size: 16px;
8
- margin-top: 0;
9
  }
10
 
11
- p {
12
- color: rgb(107, 114, 128);
13
- font-size: 15px;
14
- margin-bottom: 10px;
15
- margin-top: 5px;
16
  }
17
 
18
- .card {
19
- max-width: 620px;
20
- margin: 0 auto;
21
- padding: 16px;
22
- border: 1px solid lightgray;
23
- border-radius: 16px;
24
  }
25
 
26
- .card p:last-child {
27
- margin-bottom: 0;
 
28
  }
 
 
 
 
 
1
+ @import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@400;500;600;700&display=swap');
2
+
3
  body {
4
+ font-family: 'Inter', sans-serif;
 
5
  }
6
 
7
+ .monaco-font {
8
+ font-family: 'Fira Code', monospace;
 
9
  }
10
 
11
+ /* Custom scrollbar */
12
+ ::-webkit-scrollbar {
13
+ width: 8px;
14
+ height: 8px;
 
15
  }
16
 
17
+ ::-webkit-scrollbar-track {
18
+ background: #f1f1f1;
19
+ border-radius: 10px;
 
 
 
20
  }
21
 
22
+ ::-webkit-scrollbar-thumb {
23
+ background: #888;
24
+ border-radius: 10px;
25
  }
26
+
27
+ ::-webkit-scrollbar-thumb:hover {
28
+ background: #555;
29
+ }