1
Fork 0

typescript(loopover-leaderboards): feat: basic landing page

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-28 21:40:57 +02:00 committed by prescientmoon
commit 37754f1a3f
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
25 changed files with 11052 additions and 0 deletions

View file

@ -0,0 +1,3 @@
node_modules
/build
/*.log

View file

@ -0,0 +1,4 @@
package.json
package-lock.json
yarn.lock
build

View file

@ -0,0 +1 @@
tabWidth: 4

View file

@ -0,0 +1,19 @@
# loopoverLeaderboards
## CLI Commands
* `npm install`: Installs dependencies
* `npm run start`: Runs `serve` or `dev`, depending on `NODE_ENV` value. Defaults to `dev server`
* `npm run dev`: Run a development, HMR server
* `npm run serve`: Run a production-like server
* `npm run build`: Production-ready build
* `npm run lint`: Pass TypeScript files using TSLint
* `npm run test`: Run Jest and [`preact-render-spy`](https://github.com/mzgoddard/preact-render-spy) for your tests
For detailed explanation on how things work, checkout the [CLI Readme](https://github.com/developit/preact-cli/blob/master/README.md).

View file

@ -0,0 +1,100 @@
{
"private": true,
"name": "loopoverleaderboards",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"start": "per-env",
"start:production": "npm run -s serve",
"start:development": "npm run -s dev",
"build": "preact build",
"serve": "preact build && preact serve",
"dev": "preact watch",
"lint": "tslint --project src",
"test": "jest ./tests",
"precommit": "lint-staged"
},
"lint-staged": {
"*.{js,jsx,css,md,scss}": [
"prettier --write",
"git add"
],
"*.{ts,tsx}": [
"tslint --fix",
"git add"
]
},
"eslintConfig": {
"extends": "eslint-config-aerian"
},
"eslintIgnore": [
"build/*"
],
"devDependencies": {
"@types/jest": "^23.3.10",
"@types/webpack-env": "^1.13.9",
"css-loader": "^1.0.1",
"husky": "^1.2.0",
"identity-obj-proxy": "^3.0.0",
"jest": "^23.6.0",
"lint-staged": "^8.1.0",
"per-env": "^1.0.2",
"preact-cli": "^3.0.0-next.19",
"preact-render-spy": "^1.3.0",
"prettier": "^1.15.3",
"ts-jest": "^23.10.5",
"ts-loader": "^3.5.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.17.0",
"tslint-consistent-codestyle": "^1.14.1",
"tslint-eslint-rules": "^5.4.0",
"tslint-react": "^3.6.0",
"typescript": "^3.2.1",
"typings-for-css-modules-loader": "^1.7.0"
},
"dependencies": {
"jsxstyle": "^2.2.0",
"preact": "^10.0.0",
"preact-jsx-chai": "^3.0.0",
"preact-markup": "^2.0.0",
"preact-render-to-string": "^5.0.6",
"preact-router": "^3.0.1"
},
"peerDependencies": {
"prettier": ">1.0.0",
"tslint": ">5.0.0"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"verbose": true,
"setupFiles": [
"<rootDir>/src/tests/__mocks__/browserMocks.js"
],
"testURL": "http://localhost:8080",
"moduleFileExtensions": [
"js",
"jsx",
"ts",
"tsx"
],
"moduleDirectories": [
"node_modules"
],
"testMatch": [
"**/__tests__/**/*.[jt]s?(x)",
"**/?(*.)(spec|test).[jt]s?(x)"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/tests/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "identity-obj-proxy",
"^./style$": "identity-obj-proxy",
"^preact$": "<rootDir>/node_modules/preact/dist/preact.min.js",
"^react$": "preact-compat",
"^react-dom$": "preact-compat",
"^create-react-class$": "preact-compat/lib/create-react-class",
"^react-addons-css-transition-group$": "preact-css-transition-group"
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,25 @@
import { resolve } from "path";
export default function(config, env, helpers) {
// Switch css-loader for typings-for-css-modules-loader, which is a wrapper
// that automatically generates .d.ts files for loaded CSS
helpers.getLoadersByName(config, "css-loader").forEach(({ loader }) => {
loader.loader = "typings-for-css-modules-loader";
loader.options = Object.assign(loader.options, {
camelCase: true,
banner:
"// This file is automatically generated from your CSS. Any edits will be overwritten.",
namedExport: true,
silent: true
});
});
// Use any `index` file, not just index.js
config.resolve.alias["preact-cli-entrypoint"] = resolve(
process.cwd(),
"src",
"index"
);
return config;
}

View file

@ -0,0 +1,5 @@
{
"presets": [
["preact-cli/babel", { "modules": "commonjs" }]
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 626 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

View file

@ -0,0 +1,22 @@
@import url("https://fonts.googleapis.com/css?family=Varela+Round&display=swap");
html,
body {
height: 100%;
width: 100%;
display: block;
padding: 0;
margin: 0;
}
#app {
height: 100%;
}
:root {
--title-font: "Varela Round", sans-serif;
--max-width: 800px;
--spacing: 2rem;
--primary: #706b4e;
--on-primary: #efd9ce;
}

View file

@ -0,0 +1,4 @@
import { App } from "./modules/core/components/App.tsx";
import "./global.css";
export default App;

View file

@ -0,0 +1,21 @@
{
"name": "loopoverLeaderboards",
"short_name": "loopoverLeaderboards",
"start_url": "/",
"display": "standalone",
"orientation": "portrait",
"background_color": "#fff",
"theme_color": "#673ab8",
"icons": [
{
"src": "/assets/icons/android-chrome-192x192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/assets/icons/android-chrome-512x512.png",
"type": "image/png",
"sizes": "512x512"
}
]
}

View file

@ -0,0 +1,19 @@
import { h } from "preact";
import { Route, Router } from "preact-router";
import { Home } from "./Home";
if ((module as any).hot) {
// tslint:disable-next-line:no-var-requires
require("preact/debug");
}
export const App: preact.FunctionalComponent = () => {
return (
<div id="app">
<Router>
<Route path="/" component={Home} />
</Router>
</div>
);
};

View file

@ -0,0 +1,6 @@
import { Col, CSSProperties } from "jsxstyle";
import { FunctionComponent, h } from "preact";
export const Centered: FunctionComponent<CSSProperties> = props => {
return <Col justifyContent="center" alignItems="center" {...props} />;
};

View file

@ -0,0 +1,48 @@
import { Block, Col } from "jsxstyle";
import { h } from "preact";
import { Centered } from "./Centered";
import { Layer, Stack } from "./Stack";
const angle = -4;
const tan = -Math.tan((angle / 180) * Math.PI);
const offset = `${tan} * 50vw`;
const offsetCalc = `calc(${offset})`;
export const Home = () => {
return (
<Stack height="100%" background="var(--primary)">
<Layer
transformOrigin="top left"
transform={`skewY(${angle}deg)`}
height={`calc(50% + ${offset})`}
filter="blur(4px) brightness(0.8) sepia(60%) grayscale(30%)"
background-image="url(../../../assets/board.png)"
/>
<Layer>
<Centered height="100%">
<Centered
height="50%"
color="white"
fontSize="4rem"
fontFamily="var(--title-font)"
marginBottom={offsetCalc}
>
<Block>Loopover</Block>
</Centered>
<Centered
height={`calc(50vh - ${offset})`}
fontSize="30px"
color="var(--on-primary)"
maxWidth="var(--max-width)"
margin={offsetCalc}
>
<Block>
Loopover is a 2D Rubik's Cube-like puzzle originally
developed by Cary Huang
</Block>
</Centered>
</Centered>
</Layer>
</Stack>
);
};

View file

@ -0,0 +1,21 @@
import { Block, CSSProperties } from "jsxstyle";
import { FunctionComponent, h } from "preact";
export const Stack: FunctionComponent<CSSProperties> = props => {
return <Block {...props} position="relative" />;
};
export const Layer: FunctionComponent<CSSProperties> = props => {
return (
<Block
top={0}
left={0}
bottom={0}
right={0}
position="absolute"
width="100%"
height="100%"
{...props}
/>
);
};

View file

@ -0,0 +1,61 @@
{
"compilerOptions": {
/* Basic Options */
"target":
"ES5" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */,
"module":
"ESNext" /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
// "lib": [], /* Specify library files to be included in the compilation: */
"allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
"jsx":
"react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"jsxFactory": "h",
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution":
"node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
"esModuleInterop": true
},
"include": ["src/**/*.tsx", "src/**/*.ts"]
}

View file

@ -0,0 +1,52 @@
{
"extends": [
"tslint:recommended",
"tslint-react",
"tslint-eslint-rules",
"tslint-consistent-codestyle",
"tslint-config-prettier"
],
"rules": {
"interface-name": [true, "never-prefix"],
"object-literal-sort-keys": false,
"no-empty-interface": false,
"no-submodule-imports": false,
"jsx-no-lambda": false,
"no-console": false,
"no-empty": false,
"radix": false,
"jsx-no-multiline-js": false,
"only-arrow-functions": [true, "allow-declarations"],
"no-invalid-this": true,
"ban-comma-operator": true,
"no-arg": true,
"no-duplicate-case": true,
"no-empty-character-class": true,
"no-ex-assign": true,
"no-extra-boolean-cast": true,
"no-extra-semi": true,
"no-inner-declarations": true,
"no-invalid-regexp": true,
"no-irregular-whitespace": true,
"no-regex-spaces": true,
"no-sparse-arrays": true,
"no-unexpected-multiline": true,
"valid-jsdoc": true,
"valid-typeof": true,
"early-exit": { "severity": "warning" },
"no-collapsible-if": { "severity": "warning" },
"no-unnecessary-else": { "severity": "warning" },
"no-accessor-recursion": { "severity": "warning" },
"no-else-after-return": {
"severity": "warning",
"options": "allow-else-if"
},
"no-return-undefined": { "severity": "warning" },
"no-static-this": { "severity": "warning" },
"no-var-before-return": {
"severity": "warning",
"options": "allow-destructuring"
},
"prefer-const-enum": { "severity": "warning" }
}
}