diff --git a/notes.md b/notes.md index c3fcbb2..6cd28b3 100644 --- a/notes.md +++ b/notes.md @@ -46,3 +46,9 @@ const test = convertToImage(result); console.log(result); return test; } + +## Currents Api Token + +dRj7MBwlYafKn4RJFGHIM--anhE1w_bpXLYKo7hdZIKJW0eX + +https://api.currentsapi.services/v1/latest-news?language=de&apiKey=dRj7MBwlYafKn4RJFGHIM--anhE1w_bpXLYKo7hdZIKJW0eX diff --git a/src/components/cat/cat.stories.ts b/src/components/cat/cat.stories.ts index 8fe07ab..44ac5bb 100644 --- a/src/components/cat/cat.stories.ts +++ b/src/components/cat/cat.stories.ts @@ -4,7 +4,7 @@ import { createElement } from "../../utils/createElement"; import { getRandomCat } from "../../utils/api"; export default { - title: "Components/Hello Cat", + title: "Components/Cat", parameters: { layout: "centered" }, }; diff --git a/src/components/headline/headline.css b/src/components/headline/headline.css new file mode 100644 index 0000000..e69de29 diff --git a/src/components/headline/headline.stories.ts b/src/components/headline/headline.stories.ts new file mode 100644 index 0000000..c807736 --- /dev/null +++ b/src/components/headline/headline.stories.ts @@ -0,0 +1,19 @@ +import "./headline.css"; +import { displayGermanHeadline } from "./headline"; +import { createElement } from "../../utils/createElement"; +import { getRandomHeadlineGerman } from "../../utils/api"; + +export default { + title: "Components/Headline", + parameters: { layout: "centered" }, +}; + +export const HeadlineFromAPI = (args, { loaded: { headline } }) => { + return displayGermanHeadline(headline); +}; + +HeadlineFromAPI.loaders = [ + async () => ({ + headline: await getRandomHeadlineGerman(), + }), +]; diff --git a/src/components/headline/headline.ts b/src/components/headline/headline.ts new file mode 100644 index 0000000..b38ccdc --- /dev/null +++ b/src/components/headline/headline.ts @@ -0,0 +1,17 @@ +import { createElement } from "../../utils/createElement"; + +export function displayGermanHeadline({ headline, link }) { + return createElement("div", { + className: "headline__container", + childs: [ + createElement("p", { + className: "headline", + innerText: headline, + }), + createElement("a", { + href: link, + innerText: "Artikel lesen", + }), + ], + }); +} diff --git a/src/components/typography/typography.css b/src/components/typography/typography.css deleted file mode 100644 index 891800d..0000000 --- a/src/components/typography/typography.css +++ /dev/null @@ -1,3 +0,0 @@ -h1 { - font-size: 2rem; -} diff --git a/src/components/typography/typography.html b/src/components/typography/typography.html deleted file mode 100644 index ea650ea..0000000 --- a/src/components/typography/typography.html +++ /dev/null @@ -1,6 +0,0 @@ -