From e87848bf8f5341b5808a7e39492f43925e2d9a71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=A0s?= Date: Sun, 25 Jun 2023 21:18:55 +0200 Subject: [PATCH] Edit Widgets folders --- src/components/WidgetCard.astro | 13 ++++++++ src/components/WidgetCardList.astro | 13 ++++++++ src/layouts/Card.astro | 3 ++ src/models/WidgetState.ts | 12 +++++++ src/pages/countdown/index.astro | 43 ------------------------- src/pages/index.astro | 13 +++++++- src/pages/widgets/clock.astro | 26 +++++++++++++++ src/pages/widgets/countdown.astro | 49 +++++++++++++++++++++++++++++ 8 files changed, 128 insertions(+), 44 deletions(-) create mode 100644 src/components/WidgetCard.astro create mode 100644 src/components/WidgetCardList.astro create mode 100644 src/layouts/Card.astro create mode 100644 src/models/WidgetState.ts delete mode 100644 src/pages/countdown/index.astro create mode 100644 src/pages/widgets/clock.astro create mode 100644 src/pages/widgets/countdown.astro diff --git a/src/components/WidgetCard.astro b/src/components/WidgetCard.astro new file mode 100644 index 0000000..2a29a67 --- /dev/null +++ b/src/components/WidgetCard.astro @@ -0,0 +1,13 @@ +--- +import {WidgetState} from '../models/WidgetState'; +type Props = { + widget: WidgetState +} + +const {widget}: Props = Astro.props; +--- + + +

{widget.data.name}

+ {widget.data.description &&

{widget.data.description}

} +
\ No newline at end of file diff --git a/src/components/WidgetCardList.astro b/src/components/WidgetCardList.astro new file mode 100644 index 0000000..89353ef --- /dev/null +++ b/src/components/WidgetCardList.astro @@ -0,0 +1,13 @@ +--- +import {WidgetState} from '../models/WidgetState'; +import WidgetCard from './WidgetCard.astro'; +type Props = { + widgets: WidgetState[] +} + +const {widgets}: Props = Astro.props; +--- + +
+ {widgets.map(widget => )} +
\ No newline at end of file diff --git a/src/layouts/Card.astro b/src/layouts/Card.astro new file mode 100644 index 0000000..657f7aa --- /dev/null +++ b/src/layouts/Card.astro @@ -0,0 +1,3 @@ +
+ +
\ No newline at end of file diff --git a/src/models/WidgetState.ts b/src/models/WidgetState.ts new file mode 100644 index 0000000..a66bc01 --- /dev/null +++ b/src/models/WidgetState.ts @@ -0,0 +1,12 @@ +import type {AstroInstance} from 'astro'; + +export interface WidgetState extends AstroInstance { + data: WidgetData +} + +type WidgetData = { + name: string + description?: string + documentationUrl?: string + image?: string +} \ No newline at end of file diff --git a/src/pages/countdown/index.astro b/src/pages/countdown/index.astro deleted file mode 100644 index 33d7ce9..0000000 --- a/src/pages/countdown/index.astro +++ /dev/null @@ -1,43 +0,0 @@ ---- - -import Layout from '../../layouts/Layout.astro';--- - - -
-

-

-
-
- - \ No newline at end of file diff --git a/src/pages/index.astro b/src/pages/index.astro index 0426940..1fe6b6a 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,10 +1,21 @@ --- import Layout from '../layouts/Layout.astro'; +import {WidgetState} from '../models/WidgetState'; +import WidgetCardList from '../components/WidgetCardList.astro'; +import Card from '../layouts/Card.astro'; + +const articles = await Astro.glob("./articles/*.md") +const widgets = await Astro.glob('./widgets/*.astro'); + +const gettingStartArticle = articles.find(article => article.frontmatter.id === "getting-start") --- -
+

Notion Widgets

+ {gettingStartArticle && } + +
\ No newline at end of file diff --git a/src/pages/widgets/clock.astro b/src/pages/widgets/clock.astro new file mode 100644 index 0000000..b4df012 --- /dev/null +++ b/src/pages/widgets/clock.astro @@ -0,0 +1,26 @@ +--- +import Layout from '../../layouts/Layout.astro'; +export const data = { + name: "Clock ⏰" +} +--- + +
+

+

+
+
+ + \ No newline at end of file diff --git a/src/pages/widgets/countdown.astro b/src/pages/widgets/countdown.astro new file mode 100644 index 0000000..4585ba2 --- /dev/null +++ b/src/pages/widgets/countdown.astro @@ -0,0 +1,49 @@ +--- +import Layout from '../../layouts/Layout.astro'; + +export const data = { + name: "Countdown ⌛️" +} +--- + + +
+

+

+
+
+ + \ No newline at end of file