Removing #3, as we're replacing it. Also adding some stuff for acord-robotics/stellarios

This commit is contained in:
Gizmotronn 2022-03-22 16:03:02 +08:00
parent 3d89f79fd0
commit f3ace466df
8 changed files with 3 additions and 113 deletions

View File

@ -3,3 +3,5 @@ title: "Private Stuff"
---
This page doesn't get published!
Original AoD Portal: https://drive.google.com/drive/folders/1Mm1gNJJnw_60izyuI7XfinMPy2zC24Vs?usp=sharing

View File

@ -1,11 +0,0 @@
const EventComponent: React.FC = () => {
const onChange = (e) => {
console.log(e);
}
return <div>
<input onChange={onChange} />
</div>
};
export default EventComponent;

View File

@ -1,14 +0,0 @@
import ReactDOM from 'react-dom';
//import UserSearch from './state/UserSearch'
//import List from './state/List'
import EventComponent from './events/EventComponent';
const App = () => {
return (
<div>
<EventComponent />
</div>
);
};
ReactDOM.render(<App />, document.getElementById('root'));

View File

@ -1,20 +0,0 @@
interface ChildProps {
colour: string;
onClick: () => void;
}
export const Child = ({ colour, onClick }: ChildProps) => {
return <div>
{colour}
<button onClick={onClick}>Click me</button>
</div>
};
export const ChildAsReactFC: React.FC<ChildProps> = ({ colour, onClick, children }) => {
return <div>
{colour}
<button onClick={onClick}>Click me</button>
</div>
};
//ChildAsReactFC.displayName = 'ChildAsReactFC';

View File

@ -1,9 +0,0 @@
import { ChildAsReactFC } from './Child';
const Parent = () => {
return <ChildAsReactFC colour="red" onClick={() => console.log('Clicked')}>;
Nothing
</ChildAsReactFC>
};
export default Parent;

View File

@ -1 +0,0 @@
/// <reference types="react-scripts" />

View File

@ -1,25 +0,0 @@
import { useState } from 'react';
const List: React.FC = () => {
const [name, setName] = useState('');
const [users, setUsers] = useState<string[]>([]);
const onClick = () => {
setName('');
setUsers([...users, name]); // Take current users array and add current name to the end
}
return (
<div>
<h3>List</h3>
<ul>
{users.map(user => <li key={user}>{user}</li>)}
</ul>
<input value={name} onChange={(e) => setName(e.target.value)} />
<button onClick={onClick}>Add item</button>
</div>
);
};
export default List;

View File

@ -1,32 +0,0 @@
import { useState } from 'react';
const users = [
{ name: 'Hello', age: 20 },
{ name: 'There', age: 20 },
{ name: 'World', age: 20 },
];
const UserSearch: React.FC = () => {
const [name, setName] = useState('');
const [user, setUser] = useState<{ name: string, age: number } | undefined>(); // Two types of values/results from a search
const onClick = () => {
const foundUser = users.find((user) => {
return user.name === name; // Connect the result of the search to the `foundUser` variable
});
setUser(foundUser);
};
return <div>
User Search
<input value={name} onChange={e => setName(e.target.value)} />
<button onClick={onClick}>Find User</button>
<div>
{user && user.name}
{user && user.age}
</div>
</div>;
}
export default UserSearch;