Skip to content

Commit

Permalink
🚀 Initial project setup, ready for getRandomCat
Browse files Browse the repository at this point in the history
  • Loading branch information
fre-ben committed Feb 13, 2021
1 parent b71d8a5 commit ccdc7b6
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 35 deletions.
17 changes: 17 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# API Info

## TheCatAPI

Thanks for signing up, welcome to the API!

Your API key:

4ed34816-c19f-4144-9082-b2ffc3df0e40

Use it as the 'x-api-key' header when making any request to the API, or by adding as a query string paramter e.g. 'api_key=4ed34816-c19f-4144-9082-b2ffc3df0e40' More details on authentication.

API Documentation | Postman Collection.

If you need any example code, or have any questions then checkout the forum: https://forum.thatapiguy.com

All the best, Aden.
Binary file removed src/assets/dog.jpg
Binary file not shown.
5 changes: 0 additions & 5 deletions src/components/avatar/avatar.css

This file was deleted.

1 change: 0 additions & 1 deletion src/components/avatar/avatar.html

This file was deleted.

9 changes: 0 additions & 9 deletions src/components/avatar/avatar.stories.js

This file was deleted.

Empty file added src/components/cat/cat.css
Empty file.
10 changes: 10 additions & 0 deletions src/components/cat/cat.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import "./cat.css";
import { helloCat } from "./randomcat";
import { createElement } from "../../utils/createElement";

export default {
title: "Components/Hello Cat",
parameters: { layout: "centered" },
};

export const helloucat = () => helloCat;
5 changes: 5 additions & 0 deletions src/components/cat/randomcat.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { createElement } from "../../utils/createElement";

export const helloCat = createElement("p", {
innerText: "Hello cats!",
});
15 changes: 0 additions & 15 deletions src/pages/welcome/welcome.css
Original file line number Diff line number Diff line change
@@ -1,15 +0,0 @@
.welcome {
height: 100vh;
width: 100vw;
background-color: #1fc8db;
background-image: linear-gradient(
141deg,
#9fb8ad 0%,
#1fc8db 51%,
#2cb5e8 75%
);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
5 changes: 0 additions & 5 deletions src/pages/welcome/welcome.html
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
<main class="welcome">
<img class="avatar" src="../../assets/dog.jpg" alt="Dog" />

<h1>Woof 🐶!</h1>
</main>
14 changes: 14 additions & 0 deletions src/utils/createElement.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export function createElement<K extends keyof HTMLElementTagNameMap>(
tagName: K,
props: Partial<HTMLElementTagNameMap[K]> & {
childs?: HTMLElement[];
}
): HTMLElementTagNameMap[K] {
const element = document.createElement(tagName);
const { childs, ...other } = props;
Object.assign(element, other);
if (childs) {
element.append(...childs);
}
return element;
}

0 comments on commit ccdc7b6

Please sign in to comment.