From 23a978e8b1b67ef4ea98922f53050d5ef871843a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoffer=20Rydest=C3=A5hl?= Date: Tue, 1 Oct 2024 22:09:24 +0200 Subject: [PATCH] added card component to project. --- src/components/Card.astro | 89 +++++++++++++++++++++++++++++++++ src/components/Events.astro | 3 +- src/pages/event/[...page].astro | 3 +- src/pages/index.astro | 26 ++++++---- 4 files changed, 108 insertions(+), 13 deletions(-) create mode 100644 src/components/Card.astro diff --git a/src/components/Card.astro b/src/components/Card.astro new file mode 100644 index 0000000..da7ccd1 --- /dev/null +++ b/src/components/Card.astro @@ -0,0 +1,89 @@ +--- +interface Props { + url?: string + img?: string + title?: string + footer: string + children?: string | HTMLElement | HTMLElement[] +} + +const { url = '#', img = 'https://fakeimg.pl/640x360', title = 'Default title', footer = 'Your name' } = Astro.props +--- + +
+
+ +
+
+

+ {title} +

+

+ +

+ + {footer} + +
+
+ + diff --git a/src/components/Events.astro b/src/components/Events.astro index 96b2c1a..8875fa9 100644 --- a/src/components/Events.astro +++ b/src/components/Events.astro @@ -1,5 +1,6 @@ --- -import { Card } from 'accessible-astro-components' + +import Card from '../components/Card.astro' import { Icon } from 'astro-icon/components' const response = await fetch('https://graphql.datocms.com/', { diff --git a/src/pages/event/[...page].astro b/src/pages/event/[...page].astro index 450eea1..dca29e1 100644 --- a/src/pages/event/[...page].astro +++ b/src/pages/event/[...page].astro @@ -1,6 +1,7 @@ --- import DefaultLayout from '../../layouts/DefaultLayout.astro' -import { Card, Pagination } from 'accessible-astro-components' +import { Pagination } from 'accessible-astro-components' +import Card from '../../components/Card.astro' export async function getStaticPaths({ paginate }) { const response = await fetch('https://graphql.datocms.com/', { diff --git a/src/pages/index.astro b/src/pages/index.astro index e630082..53d2918 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -50,18 +50,21 @@ const { page } = Astro.props
-
-
-
-

{pitch1Title}

-

- {pitch1Body} -

-
- -
+
+
+

{pitch1Title}

+

+ {pitch1Body} +

+
+
+
+
+
+ +
@@ -140,6 +143,7 @@ const { page } = Astro.props box-shadow: 1px 8px 24px 0px rgba(0, 0, 0, 0.75); -webkit-box-shadow: 1px 8px 24px 0px rgba(0, 0, 0, 0.75); -moz-box-shadow: 1px 8px 24px 0px rgba(0, 0, 0, 0.75); + background-size: 100vw; } .card { @@ -150,7 +154,7 @@ const { page } = Astro.props /* Dina mobilspecifika CSS-regler här */ .container-bg { padding: 1rem; - background-size: cover; + background-size: 100vw; .container-content { padding-left: 1rem;