From 6bf0c531bafcbb88d840a65c5369773026e269d3 Mon Sep 17 00:00:00 2001 From: Artur Tamborski Date: Sun, 15 Nov 2020 09:05:32 +0100 Subject: [PATCH] add type hints --- public/manifest.json | 14 ++------------ src/components/App/App.tsx | 4 +--- src/components/Board/Board.css | 4 ++-- src/components/Board/Board.tsx | 19 +++++++++++-------- src/components/Logo/Logo.tsx | 4 +--- tsconfig.json | 2 +- 6 files changed, 18 insertions(+), 29 deletions(-) diff --git a/public/manifest.json b/public/manifest.json index 080d6c7..f4b1c4c 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,21 +1,11 @@ { - "short_name": "React App", - "name": "Create React App Sample", + "short_name": "crosski", + "name": "Play crosski online!", "icons": [ { "src": "favicon.ico", "sizes": "64x64 32x32 24x24 16x16", "type": "image/x-icon" - }, - { - "src": "logo192.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "logo512.png", - "type": "image/png", - "sizes": "512x512" } ], "start_url": ".", diff --git a/src/components/App/App.tsx b/src/components/App/App.tsx index 4a1cf22..40d9664 100644 --- a/src/components/App/App.tsx +++ b/src/components/App/App.tsx @@ -5,7 +5,7 @@ import Board from '../Board/Board'; import './App.css'; -function App() { +export default function App(): JSX.Element { return (
@@ -13,5 +13,3 @@ function App() {
); } - -export default App; diff --git a/src/components/Board/Board.css b/src/components/Board/Board.css index 6cbc580..092fdc8 100644 --- a/src/components/Board/Board.css +++ b/src/components/Board/Board.css @@ -13,8 +13,8 @@ font-size: larger; padding: 20px; background: ghostwhite; - border-radius: 25px; - border-color: #E5E5EA; + border-radius: 1rem; + border-color: #e5e5ea; color: brown; cursor: pointer; } diff --git a/src/components/Board/Board.tsx b/src/components/Board/Board.tsx index 2fc12ca..67edd60 100644 --- a/src/components/Board/Board.tsx +++ b/src/components/Board/Board.tsx @@ -1,8 +1,13 @@ -import React, { Component } from 'react'; +import React from 'react'; +import PropTypes from 'prop-types'; import './Board.css'; -class Board extends Component { +export default class Board extends React.Component { + + static propTypes = { + clickHandler: PropTypes.func, + }; genSquares() { let squares = []; @@ -22,12 +27,12 @@ class Board extends Component { return squares; } - onMouseDown() { - console.log("down") + onMouseMove() { + return 1; } - onMouseMove() { - console.log("move") + onMouseDown() { + return 1; } render() { @@ -42,5 +47,3 @@ class Board extends Component { ); } } - -export default Board; diff --git a/src/components/Logo/Logo.tsx b/src/components/Logo/Logo.tsx index 0779b1d..3ac0368 100644 --- a/src/components/Logo/Logo.tsx +++ b/src/components/Logo/Logo.tsx @@ -3,12 +3,10 @@ import React from 'react'; import Wide from './crosski_wide.svg' import './Logo.css'; -function Logo() { +export default function Logo(): JSX.Element { return (
Logo
); } - -export default Logo; diff --git a/tsconfig.json b/tsconfig.json index 8f02d45..4c5029e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,6 @@ "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, @@ -23,6 +22,7 @@ "declaration": true, "noUnusedLocals": true, "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, "incremental": true }, "include": [