-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christoffer Rydeståhl
committed
Oct 1, 2024
1 parent
c3da517
commit 23a978e
Showing
4 changed files
with
108 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
--- | ||
|
||
<div class="card"> | ||
<div class="card__image"> | ||
<img src={img} alt="" /> | ||
</div> | ||
<div class="card__content"> | ||
<h3> | ||
<a href={url}>{title}</a> | ||
</h3> | ||
<p> | ||
|
||
</p> | ||
<small> | ||
{footer} | ||
</small> | ||
</div> | ||
</div> | ||
|
||
<style is:global> | ||
.card { | ||
display: flex; | ||
flex-direction: column; | ||
max-width: 60ch; | ||
min-height: 100%; | ||
position: relative; | ||
overflow: hidden; | ||
transition: box-shadow 0.15s ease-in-out; | ||
border: none !important; | ||
} | ||
|
||
.card:hover, | ||
.card:focus-within { | ||
box-shadow: 0 0 0 0.25rem; | ||
} | ||
|
||
.card:focus-within a:focus { | ||
text-decoration: none !important; | ||
box-shadow: none; | ||
outline: none; | ||
} | ||
|
||
.card__image { | ||
height: 10rem; | ||
} | ||
|
||
.card__image img { | ||
height: 100%; | ||
width: 100%; | ||
object-fit: cover; | ||
} | ||
|
||
.card__content { | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
padding: 1rem; | ||
} | ||
|
||
.card__content a { | ||
text-decoration: none; | ||
} | ||
|
||
.card__content a:focus { | ||
text-decoration: none; | ||
} | ||
|
||
.card__content a::after { | ||
content: ''; | ||
position: absolute; | ||
inset: 0; | ||
text-decoration: none; | ||
} | ||
|
||
.card__content:last-child { | ||
margin-top: auto; | ||
padding-top: 2rem; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters