Skip to content

Commit

Permalink
just testing for seeing if cloudflare changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JonkerKoorts committed Nov 8, 2022
1 parent 790b445 commit 3685317
Show file tree
Hide file tree
Showing 11 changed files with 198 additions and 56 deletions.
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"stream": "^0.0.2",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
6 changes: 6 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Bigelow+Rules&display=swap"
rel="stylesheet"
/>
<title>React App</title>
</head>
<body>
Expand Down
53 changes: 19 additions & 34 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,23 @@
.App {
body {
margin: 0;
padding: 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;
background: linear-gradient(
to left,
rgba(7, 27, 82, 1) 0%,
rgba(0, 128, 128, 1) 100%
);
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);
}
.app-title {
margin: 50px;
font-size: 120px;
color: #0ccac4;
font-family: "Bigelow Rules";
letter-spacing: 7.5px;
}
74 changes: 52 additions & 22 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
import logo from './logo.svg';
import './App.css';

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
</div>
);
import { Component } from "react";

import Cardlist from "./components/card-list/card-list.component";
import "./App.css";
import SearchBox from "./components/search-box/search-box.component";

class App extends Component {
constructor() {
super();

this.state = {
monsters: [],
searchField: "",
};
}

componentDidMount() {
fetch("https://jsonplaceholder.typicode.com/users").then((response) =>
response.json().then((users) =>
this.setState(() => {
return { monsters: users };
})
)
);
} // Mounting is the first time when a application gets rendered onto the dom.

onSearchChange = (event) => {
const searchField = event.target.value.toLowerCase();
this.setState(() => {
return { searchField };
});
};

render() {
const { monsters, searchField } = this.state;
const { onSearchChange } = this;

const filteredMonsters = this.state.monsters.filter((monster) => {
return monster.name.toLowerCase().includes(this.state.searchField);
});
return (
<div className="App">
<h1 className="app-title">Monster Filter</h1>
<SearchBox
onChangeHandler={onSearchChange}
placeHolder="Search Monsters"
className="monstersSearchBox"
/>
<Cardlist monsters={filteredMonsters} />
</div>
);
}
}

export default App;
20 changes: 20 additions & 0 deletions src/components/card-list/card-list.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { computeHeadingLevel } from "@testing-library/react";
import { Component } from "react";
import Card from "../card/card.component";
import "./card-list.styles.css";

class Cardlist extends Component {
render() {
const { monsters } = this.props;

return (
<div className="card-list">
{monsters.map((monsters) => {
return <Card monsterProp={monsters} />;
})}
</div>
);
}
}

export default Cardlist;
7 changes: 7 additions & 0 deletions src/components/card-list/card-list.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.card-list {
width: 85vw;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-gap: 20px;
}
21 changes: 21 additions & 0 deletions src/components/card/card.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Component } from "react";

import "./card.styles.css";

class Card extends Component {
render() {
const { id, name, email } = this.props.monsterProp;
return (
<div className="card-container" key={id}>
<img
alt={`monster ${name}`}
src={`https://robohash.org/${id}?set=set2&size=180x180`}
/>
<h2>{name}</h2>
<p>{email}</p>
</div>
);
}
}

export default Card;
17 changes: 17 additions & 0 deletions src/components/card/card.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.card-container {
display: flex;
flex-direction: column;
background-color: #95dada;
border: 1px solid grey;
border-radius: 5px;
padding: 25px;
cursor: pointer;
-moz-osx-font-smoothing: grayscale;
backface-visibility: hidden;
transform: translateZ(0);
transition: transform 0.25s ease-out;
}

.card-container:hover {
transform: scale(1.05);
}
19 changes: 19 additions & 0 deletions src/components/search-box/search-box.component.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component } from "react";
import "./search-box.styles.css";

class SearchBox extends Component {
render() {
return (
<div>
<input
className={`search-box ${this.props.className}`}
type="search"
placeholder={this.props.placeHolder}
onChange={this.props.onChangeHandler}
/>
</div>
);
}
}

export default SearchBox;
9 changes: 9 additions & 0 deletions src/components/search-box/search-box.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.search-box {
-webkit-appearance: none;
border: none;
outline: none;
padding: 10px;
width: 150px;
line-height: 30px;
margin-bottom: 30px;
}

0 comments on commit 3685317

Please sign in to comment.