-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ui): creating a playground for the new components (#4301)
Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
- Loading branch information
Showing
20 changed files
with
1,202 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0" | ||
/> | ||
<title><%= htmlWebpackPlugin.options.title %></title> | ||
</head> | ||
<body class="bg-gray-100"> | ||
<div | ||
id="root" | ||
class="min-h-screen" | ||
></div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
const path = require('path'); | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
// const { TsconfigPathsPlugin } = require('tsconfig-paths-webpack-plugin'); | ||
const MiniCssExtractPlugin = require('mini-css-extract-plugin'); | ||
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin'); | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin'); | ||
|
||
const isDevelopment = process.env.NODE_ENV !== 'production'; | ||
const isProdBuild = process.env.NODE_ENV === 'production'; | ||
|
||
const autoprefixer = require('autoprefixer'); | ||
const tailwindcss = require('tailwindcss'); | ||
const tailwindConfigPath = path.resolve('./tailwind.config.js'); | ||
|
||
const cssToJavaScript = { | ||
test: /\.css$/, | ||
use: [ | ||
//'style-loader', | ||
isDevelopment ? 'style-loader' : MiniCssExtractPlugin.loader, | ||
{ loader: 'css-loader', options: { importLoaders: 1 } }, | ||
{ | ||
loader: 'postcss-loader', | ||
options: { | ||
postcssOptions: { | ||
verbose: true, | ||
plugins: [ | ||
[tailwindcss(tailwindConfigPath)], | ||
[autoprefixer('last 2 version', 'ie >= 11')], | ||
], | ||
}, | ||
}, | ||
}, | ||
], | ||
}; | ||
|
||
module.exports = { | ||
mode: 'development', | ||
entry: { | ||
home: './src/_pages/index.tsx', | ||
playground: './src/_pages/playground.tsx', | ||
viewer: './src/_pages/viewer.tsx', | ||
colors: './src/_pages/colors.tsx', | ||
// add other pages here | ||
}, | ||
output: { | ||
filename: '[name].bundle.js', | ||
path: path.resolve(__dirname, 'dist'), | ||
clean: true, | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.tsx', '.js', '.jsx'], | ||
// plugins: [new TsconfigPathsPlugin()], | ||
}, | ||
|
||
module: { | ||
rules: [ | ||
...(isProdBuild | ||
? [] | ||
: [ | ||
{ | ||
test: /\.[jt]sx?$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
options: { | ||
plugins: ['react-refresh/babel'], | ||
}, | ||
}, | ||
]), | ||
cssToJavaScript, | ||
], | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
|
||
new HtmlWebpackPlugin({ | ||
template: './.webpack/template.html', | ||
chunks: ['home'], | ||
filename: 'index.html', | ||
}), | ||
new HtmlWebpackPlugin({ | ||
template: './.webpack/template.html', | ||
chunks: ['playground'], | ||
filename: 'playground.html', | ||
}), | ||
new HtmlWebpackPlugin({ | ||
template: './.webpack/template.html', | ||
chunks: ['viewer'], | ||
filename: 'viewer.html', | ||
}), | ||
new HtmlWebpackPlugin({ | ||
template: './.webpack/template.html', | ||
chunks: ['colors'], | ||
filename: 'colors.html', | ||
}), | ||
new MiniCssExtractPlugin({ | ||
filename: '[name].css', | ||
}), | ||
isDevelopment && new ReactRefreshWebpackPlugin(), | ||
!isDevelopment && | ||
new MiniCssExtractPlugin({ | ||
filename: '[name].css', | ||
}), | ||
], | ||
devServer: { | ||
static: { | ||
directory: path.join(__dirname, 'dist'), | ||
}, | ||
hot: true, | ||
open: true, | ||
port: 8000, | ||
historyApiFallback: true, | ||
devMiddleware: { | ||
writeToDisk: true, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// https://babeljs.io/docs/en/options#babelrcroots | ||
const { extendDefaultPlugins } = require('svgo'); | ||
|
||
module.exports = { | ||
babelrcRoots: ['./platform/*', './extensions/*', './modes/*'], | ||
presets: ['@babel/preset-env', '@babel/preset-react', '@babel/preset-typescript'], | ||
plugins: [ | ||
['@babel/plugin-proposal-class-properties', { loose: true }], | ||
'@babel/plugin-transform-typescript', | ||
['@babel/plugin-proposal-private-methods', { loose: true }], | ||
'@babel/plugin-transform-class-static-block', | ||
], | ||
env: { | ||
test: { | ||
presets: [ | ||
[ | ||
// TODO: https://babeljs.io/blog/2019/03/19/7.4.0#migration-from-core-js-2 | ||
'@babel/preset-env', | ||
{ | ||
modules: 'commonjs', | ||
debug: false, | ||
}, | ||
], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript', | ||
], | ||
plugins: [ | ||
'@babel/plugin-proposal-object-rest-spread', | ||
'@babel/plugin-syntax-dynamic-import', | ||
'@babel/plugin-transform-regenerator', | ||
'@babel/transform-destructuring', | ||
'@babel/plugin-transform-runtime', | ||
'@babel/plugin-transform-typescript', | ||
'@babel/plugin-transform-class-static-block', | ||
], | ||
}, | ||
production: { | ||
presets: [ | ||
// WebPack handles ES6 --> Target Syntax | ||
['@babel/preset-env', { modules: false }], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript', | ||
], | ||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'], | ||
}, | ||
development: { | ||
presets: [ | ||
// WebPack handles ES6 --> Target Syntax | ||
['@babel/preset-env', { modules: false }], | ||
'@babel/preset-react', | ||
'@babel/preset-typescript', | ||
], | ||
plugins: ['react-refresh/babel'], | ||
ignore: ['**/*.test.jsx', '**/*.test.js', '__snapshots__', '__tests__'], | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is our playground for designing and developing the next generation of the platform's UI. You probably don't need to be here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
import '../tailwind.css'; | ||
|
||
function Colors() { | ||
return ( | ||
<main> | ||
<h2>Primary color</h2> | ||
<div className="row"> | ||
<div className="example2"> | ||
<div className="bg-primary h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary/80 h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary/60 h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary/40 h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary/20 h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-infosecondary h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-highlight h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-highlight h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="h-16 w-16 rounded bg-white"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="h-16 w-16 rounded bg-white"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="h-16 w-16 rounded bg-white"></div> | ||
</div> | ||
</div> | ||
|
||
<h2>New colors</h2> | ||
<div className="row"> | ||
<div className="example2"> | ||
<div className="bg-highlight h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-bkg-low h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-bkg-med h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-bkg-full h-16 w-16 rounded"></div> | ||
</div> | ||
</div> | ||
|
||
<h2>Core colors</h2> | ||
<div className="row"> | ||
<div className="example2"> | ||
<div className="bg-background h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-card h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-card-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-popover h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-popover-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-primary-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-secondary h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-secondary-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-muted h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-muted-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-accent h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-accent-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="destructive h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="destructive-foreground h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-border h-16 w-16 rounded"></div> | ||
</div> | ||
</div> | ||
|
||
<h2>Borders</h2> | ||
<div className="row"> | ||
<div className="example2"> | ||
<div className="bg-border h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-input h-16 w-16 rounded"></div> | ||
</div> | ||
<div className="example2"> | ||
<div className="bg-ring h-16 w-16 rounded"></div> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
} | ||
|
||
const container = document.getElementById('root'); | ||
const root = createRoot(container); | ||
root.render(React.createElement(Colors)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from 'react'; | ||
import { createRoot } from 'react-dom/client'; | ||
|
||
import '../tailwind.css'; | ||
|
||
const App: React.FC = () => ( | ||
<div className="container mx-auto p-4"> | ||
<h1 className="mb-4 text-2xl font-bold">Home Page</h1> | ||
<nav className="space-x-4"> | ||
<a | ||
href="playground.html" | ||
className="text-blue-500 hover:text-blue-700" | ||
> | ||
Playground | ||
</a> | ||
<a | ||
href="viewer.html" | ||
className="text-blue-500 hover:text-blue-700" | ||
> | ||
Viewer | ||
</a> | ||
<a | ||
href="colors.html" | ||
className="text-blue-500 hover:text-blue-700" | ||
> | ||
Colors | ||
</a> | ||
</nav> | ||
</div> | ||
); | ||
|
||
const container = document.getElementById('root'); | ||
const root = createRoot(container); | ||
root.render(React.createElement(App)); |
Oops, something went wrong.