From 0a2e91ad77882863d618fe9bbc95c3807b6c11dd Mon Sep 17 00:00:00 2001 From: Maciej Jur Date: Sun, 25 Jun 2023 00:50:59 +0200 Subject: [PATCH] (home) card styles --- src/components/cards/Contact.astro | 34 ++++++++++++------- src/components/cards/Photo.astro | 8 ++--- src/layouts/Home.astro | 2 +- src/styles/layouts/_home.scss | 54 ++++++++++++++++++++++++++++++ src/styles/partials/_card.scss | 44 ------------------------ src/styles/styles.scss | 1 - 6 files changed, 80 insertions(+), 63 deletions(-) delete mode 100644 src/styles/partials/_card.scss diff --git a/src/components/cards/Contact.astro b/src/components/cards/Contact.astro index 4aeddab..79099f0 100644 --- a/src/components/cards/Contact.astro +++ b/src/components/cards/Contact.astro @@ -1,17 +1,25 @@ --- -const email = "maciej@kamoshi.org"; -const discord = "kamov#2485"; +import { Maybe } from 'purify-ts'; +interface Props { + email?: string; + discord?: string; +} --- -
-

Contact

-
- {email && ( - email - {email} - )} - {discord && ( - discord - {discord} - )} +
+

Contact

+
+ {Maybe.fromNullable(Astro.props.email) + .map(email => [`mailto:${email}`, email] as const) + .map(([href, email]) => [ + email, + {email} + ]).extract() + } + {Maybe.fromNullable(Astro.props.discord) + .map(discord => [ + discord, + {discord} + ]).extract() + }
diff --git a/src/components/cards/Photo.astro b/src/components/cards/Photo.astro index d2d0b44..6f74139 100644 --- a/src/components/cards/Photo.astro +++ b/src/components/cards/Photo.astro @@ -4,9 +4,9 @@ import Image from "astro/components/Image.astro"; const alt = "A building covered by multicolor Ivy."; --- -
-

Image of the Month

- - {alt} +
+

Image of the Month

+
+ {alt}
diff --git a/src/layouts/Home.astro b/src/layouts/Home.astro index f4d4231..ad3aa1b 100644 --- a/src/layouts/Home.astro +++ b/src/layouts/Home.astro @@ -16,7 +16,7 @@ import Base from "./Base.astro"; - + diff --git a/src/styles/layouts/_home.scss b/src/styles/layouts/_home.scss index 0c55c5a..993cc53 100644 --- a/src/styles/layouts/_home.scss +++ b/src/styles/layouts/_home.scss @@ -33,6 +33,60 @@ } } +.p-card { + padding: 1em; + border-radius: 0.25em; + background-color: white; + box-shadow: var(--shadow-l); + + &__heading { + line-height: 1em; + margin-bottom: 0.5em; + font-family: var(--serif); + font-weight: 500; + } +} + +.home-card-image { + &__link { + display: block; + } + &__image { + width: 100%; + height: auto; + } +} + +.home-card-contact { + a { + color: var(--c-primary); + font-family: var(--serif); + font-weight: 500; + font-style: italic; + text-decoration: unset; + font-size: 1.1em; + + &:hover { + text-decoration: underline; + } + } + &__grid { + display: grid; + grid-template-columns: auto 1fr; + row-gap: 0.5em; + column-gap: 0.5em; + } + &__image { + max-width: 2em; + height: auto; + margin: 0 0.5em 0 0; + } + &__text { + display: inline-flex; + align-items: center; + } +} + .intro-jp { max-height: 18em; min-width: fit-content; diff --git a/src/styles/partials/_card.scss b/src/styles/partials/_card.scss deleted file mode 100644 index 08763f1..0000000 --- a/src/styles/partials/_card.scss +++ /dev/null @@ -1,44 +0,0 @@ -.p-card { - padding: 1em; - border-radius: 5px; - background-color: white; - box-shadow: var(--shadow-l); - - &__header { - margin-top: 0; - } - - &-latest { - &__pages { - display: grid; - grid-template-columns: 4em 1fr; - row-gap: 0.5em; - } - } - - &-image { - &__image { - width: 100%; - height: auto; - } - } - - &-contact { - &__grid { - display: grid; - grid-template-columns: 3em 1fr; - row-gap: 0.5em; - } - - &__image { - max-width: 2em; - height: auto; - margin: 0 0.5em 0 0; - } - - &__text { - display: inline-flex; - align-items: center; - } - } -} diff --git a/src/styles/styles.scss b/src/styles/styles.scss index ce28c31..680eb64 100644 --- a/src/styles/styles.scss +++ b/src/styles/styles.scss @@ -20,7 +20,6 @@ @use 'partials/nav'; @use 'partials/footer'; @use 'partials/github'; -@use 'partials/card'; @use 'partials/header'; @use 'partials/pagelist'; @use 'partials/toc';