Monaco code example working

This commit is contained in:
2025-02-22 23:24:31 -06:00
parent ae4bc3e0a9
commit 6c7fc895f8
6 changed files with 37 additions and 39 deletions
+1 -12
View File
@@ -1,18 +1,7 @@
import type { NextConfig } from "next"; import type { NextConfig } from "next";
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');
const nextConfig: NextConfig = { const nextConfig: NextConfig = {
webpack: (config, { isServer }) => { /* config options here */
if (!isServer) {
config.plugins.push(
new MonacoWebpackPlugin({
languages: ['typescript', 'javascript'],
filename: 'static/[name].worker.js',
})
);
}
return config;
},
}; };
export default nextConfig; export default nextConfig;
+27
View File
@@ -8,6 +8,7 @@
"name": "unicord-website", "name": "unicord-website",
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@monaco-editor/react": "^4.7.0",
"monaco-editor": "^0.52.2", "monaco-editor": "^0.52.2",
"monaco-editor-webpack-plugin": "^7.1.0", "monaco-editor-webpack-plugin": "^7.1.0",
"next": "15.1.7", "next": "15.1.7",
@@ -442,6 +443,27 @@
"@jridgewell/sourcemap-codec": "^1.4.14" "@jridgewell/sourcemap-codec": "^1.4.14"
} }
}, },
"node_modules/@monaco-editor/loader": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@monaco-editor/loader/-/loader-1.5.0.tgz",
"integrity": "sha512-hKoGSM+7aAc7eRTRjpqAZucPmoNOC4UUbknb/VNoTkEIkCPhqV8LfbsgM1webRM7S/z21eHEx9Fkwx8Z/C/+Xw==",
"dependencies": {
"state-local": "^1.0.6"
}
},
"node_modules/@monaco-editor/react": {
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@monaco-editor/react/-/react-4.7.0.tgz",
"integrity": "sha512-cyzXQCtO47ydzxpQtCGSQGOC8Gk3ZUeBXFAxD+CWXYFo5OqZyZUonFl0DwUlTyAfRHntBfw2p3w4s9R6oe1eCA==",
"dependencies": {
"@monaco-editor/loader": "^1.5.0"
},
"peerDependencies": {
"monaco-editor": ">= 0.25.0 < 1",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/@next/env": { "node_modules/@next/env": {
"version": "15.1.7", "version": "15.1.7",
"resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.7.tgz", "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.7.tgz",
@@ -1791,6 +1813,11 @@
"url": "https://github.com/sponsors/wooorm" "url": "https://github.com/sponsors/wooorm"
} }
}, },
"node_modules/state-local": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/state-local/-/state-local-1.0.7.tgz",
"integrity": "sha512-HTEHMNieakEnoe33shBYcZ7NX83ACUjCu8c40iOGEZsngj9zRnkqS9j1pqQPXwobB0ZcVTk27REb7COQ0UR59w=="
},
"node_modules/streamsearch": { "node_modules/streamsearch": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz", "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
+1
View File
@@ -9,6 +9,7 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"@monaco-editor/react": "^4.7.0",
"monaco-editor": "^0.52.2", "monaco-editor": "^0.52.2",
"monaco-editor-webpack-plugin": "^7.1.0", "monaco-editor-webpack-plugin": "^7.1.0",
"next": "15.1.7", "next": "15.1.7",
+4 -3
View File
@@ -100,10 +100,11 @@
pointer-events: none; pointer-events: none;
} }
.hero > div:nth-child(2) { .codeExample {
flex: 1; flex: 1;
min-width: 45%; max-width: 60%;
height: 100%; height: 75%;
max-height: 500px;
} }
.code { .code {
+2 -22
View File
@@ -24,32 +24,12 @@ export default function Home() {
Finally a simpler way to build Discord bots.{" "} Finally a simpler way to build Discord bots.{" "}
</p> </p>
</div> </div>
<div> <div className={styles.codeExample}>
<CodeExample /> <CodeExample />
</div> </div>
</div> </div>
<div> <div className={styles.pillars}>
<h2 className={styles.title}>Features</h2>
<ul className={styles.features}>
<li>TypeScript support</li>
<li>Intuitive API</li>
<li>Powerful command system</li>
<li>Built-in event handling</li>
<li>Easy to use</li>
</ul>
<h2 className={styles.title}>Get Started</h2>
<p className={styles.description}>
To get started, check out the{" "}
<a href="https://unicord.dev" target="_blank">
<span className={styles.link}>documentation</span>
</a>{" "}
or join our{" "}
<a href="https://discord.gg/9v6Z4J5q" target="_blank">
<span className={styles.link}>Discord server</span>
</a>{" "}
for help and support.
</p>
</div> </div>
</main> </main>
</div> </div>
@@ -4,6 +4,6 @@
min-height: 300px; min-height: 300px;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
margin: 20px 0; /* margin: 20px 0; */
border: 1px solid #2d2d2d; border: 1px solid #2d2d2d;
} }