Skip to content

Commit

Permalink
feat(gui): setup
Browse files Browse the repository at this point in the history
  • Loading branch information
lihbr committed Sep 5, 2023
1 parent 400da42 commit 7f8f518
Show file tree
Hide file tree
Showing 21 changed files with 6,158 additions and 380 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ module.exports = {
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"plugin:react-hooks/recommended",
],
plugins: ["eslint-plugin-tsdoc"],
plugins: ["eslint-plugin-tsdoc", "react-refresh"],
rules: {
"no-console": ["warn", { allow: ["info", "warn", "error"] }],
"no-debugger": "warn",
Expand All @@ -34,5 +35,9 @@ module.exports = {
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "error",
"tsdoc/syntax": "warn",
"react-refresh/only-export-components": [
"warn",
{ allowConstantExport: true },
],
},
};
2 changes: 1 addition & 1 deletion bin/prismic-upgrade-from-legacy.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node

import("../dist/cli.cjs");
import("../dist/cli-watcher.cjs");
13 changes: 13 additions & 0 deletions gui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
6 changes: 6 additions & 0 deletions gui/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: { config: "./gui/tailwind.config.js" },
autoprefixer: {},
},
};
1 change: 1 addition & 0 deletions gui/public/vite.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions gui/src/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Alert, AlertButton, Box } from "@prismicio/editor-ui";

export function App(): JSX.Element {
return (
<div className="bg-green-500">
<Box display="grid" gridTemplateColumns="repeat(5, 600px)" gap={16}>
<Alert
title="Title"
subtitle="This is a subtitle"
onClose={() => null}
footerButtons={
<>
<AlertButton title="Customer Support" onClick={() => null} />
<AlertButton title="Retry" onClick={() => null} />
</>
}
/>
</Box>
</div>
);
}
5 changes: 5 additions & 0 deletions gui/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@import "@prismicio/editor-ui/style.css";

@tailwind base;
@tailwind components;
@tailwind utilities;
14 changes: 14 additions & 0 deletions gui/src/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { ThemeProvider } from "@prismicio/editor-ui";
import React from "react";
import ReactDOM from "react-dom/client";

import { App } from "./App.tsx";
import "./index.css";

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<ThemeProvider>
<App />
</ThemeProvider>
</React.StrictMode>,
);
1 change: 1 addition & 0 deletions gui/src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
10 changes: 10 additions & 0 deletions gui/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @type {import("tailwindcss").Config}

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 16)

tsdoc-undefined-tag: The TSDoc tag "@type" is not defined in this configuration

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 16)

tsdoc-malformed-inline-tag: Expecting a TSDoc tag starting with "{@"

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 16)

tsdoc-escape-right-brace: The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 18)

tsdoc-undefined-tag: The TSDoc tag "@type" is not defined in this configuration

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 18)

tsdoc-malformed-inline-tag: Expecting a TSDoc tag starting with "{@"

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 18)

tsdoc-escape-right-brace: The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 20)

tsdoc-undefined-tag: The TSDoc tag "@type" is not defined in this configuration

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 20)

tsdoc-malformed-inline-tag: Expecting a TSDoc tag starting with "{@"

Check warning on line 2 in gui/tailwind.config.js

View workflow job for this annotation

GitHub Actions / Suite (ubuntu-latest, Node 20)

tsdoc-escape-right-brace: The "}" character should be escaped using a backslash to avoid confusion with a TSDoc inline tag
*/
export default {
content: ["./gui/index.html", "./gui/src/**/*.{js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
33 changes: 33 additions & 0 deletions gui/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"lib": [
"ES2020",
"DOM",
"DOM.Iterable"
],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": [
"src"
],
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
10 changes: 10 additions & 0 deletions gui/tsconfig.node.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"composite": true,
"skipLibCheck": true,
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
},
"include": ["vite.config.ts"]
}
11 changes: 11 additions & 0 deletions gui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import react from "@vitejs/plugin-react";
import { defineConfig } from "vite";

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
root: __dirname,
build: {
outDir: "../dist/gui",
},
});

0 comments on commit 7f8f518

Please sign in to comment.