Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nick/react intro #10

Merged
merged 3 commits into from
Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
],
parser: '@typescript-eslint/parser',
Expand All @@ -21,5 +22,14 @@ module.exports = {
plugins: ['react', '@typescript-eslint', 'prettier'],
rules: {
'prettier/prettier': ['error', { singleQuote: true }],
'react/prop-types': 0,
},
overrides: [
{
files: ['webpack.config.js'],
rules: {
'@typescript-eslint/no-var-requires': ['off'],
},
},
],
};
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Minesweeper

## Secture 1: Introduction
## Section 1: Introduction

### Minesweeper presentation

Expand All @@ -16,6 +16,9 @@

[Pull request](https://github.com/nickovchinnikov/minesweeper/pull/2)


## Section 2: Typescript recap

### Typescript basic
### Parametric typing with generics
### Interfaces, Types and Union
Expand All @@ -30,16 +33,37 @@

[Pull request](https://github.com/nickovchinnikov/minesweeper/pull/4)

## Secture 2: Jest and TDD
## Section 3: React intro

### Ecma TC39 and Babel
### Create React App

[Pull request](https://github.com/nickovchinnikov/minesweeper/pull/5)
[Create React App](https://create-react-app.dev/)

[What is Babel?](https://babeljs.io/docs/en/)
### JSX at Glance

[Introducing JSX](https://reactjs.org/docs/introducing-jsx.html)

### JSX compilation

[Introducing the New JSX Transform](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)

### Props and conditional rendering

### Ecma TC39 and Babel

[What is Babel?](https://babeljs.io/docs/en/)
[TC39](https://tc39.es/)

### Webpack intro

[Webpack Getting Started](https://webpack.js.org/guides/getting-started/)

### Webpack dev server

[React intro examples pull request](https://github.com/nickovchinnikov/minesweeper/pull/10/files)

## Section 4: Jest, TDD and basic game logic

### Jest testing framework (TDD vs TLD)

[Pull request](https://github.com/nickovchinnikov/minesweeper/pull/6)
Expand All @@ -48,7 +72,7 @@

[Jest and TDD](https://medium.com/@suvodeep4119/javascript-tdd-using-jest-9b535c6be7be)

### Basic game logic
### Basic game functionality

[Pull request](https://github.com/nickovchinnikov/minesweeper/pull/7)

Expand Down
6 changes: 5 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-typescript'],
presets: [
'@babel/preset-env',
'@babel/preset-typescript',
'@babel/preset-react',
],
};
38 changes: 38 additions & 0 deletions examples/ReactIntro/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
}

.App-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
50 changes: 50 additions & 0 deletions examples/ReactIntro/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { FC } from 'react';
import logo from './logo.svg';
import './App.css';

function App() {
return (
<div className="App">
<Header logo={logo}>
<p>
Edit <code>src/App.tsx</code> and save to reload!!!
</p>
<Link href="https://reactjs.org">Learn React</Link>
</Header>
</div>
);
}

interface HeaderProps {
logo?: string;
}

const Header: FC<HeaderProps> = ({ children, logo }) => (
<header className="App-header">
{logo ? (
<img src={logo} className="App-logo" alt="logo" />
) : (
'There is no any logo!'
)}
{children}
</header>
);

interface LinkProps {
href: string;
target?: '_blank' | '_self' | '_parent' | '_top';
rel?: string;
}

const Link: FC<LinkProps> = ({ children, ...restProps }) => (
<a className="App-link" {...restProps}>
{children}
</a>
);

Link.defaultProps = {
target: '_blank',
rel: 'noopener noreferrer',
};

export default App;
4 changes: 4 additions & 0 deletions examples/ReactIntro/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
declare module '*.svg' {
const src: string;
export default src;
}
13 changes: 13 additions & 0 deletions examples/ReactIntro/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
6 changes: 6 additions & 0 deletions examples/ReactIntro/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';

import App from './App';

ReactDOM.render(<App />, document.getElementById('root'));
1 change: 1 addition & 0 deletions examples/ReactIntro/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading