-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add support for picture tag (#328)
- Loading branch information
Showing
110 changed files
with
2,599 additions
and
4,688 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 |
---|---|---|
@@ -1,3 +1,14 @@ | ||
{ | ||
"proseWrap": "always" | ||
"proseWrap": "always", | ||
"plugins": [ | ||
"prettier-plugin-astro" | ||
], | ||
"overrides": [ | ||
{ | ||
"files": "*.astro", | ||
"options": { | ||
"parser": "astro" | ||
} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
--- | ||
import { CollectionEntry, getCollection } from 'astro:content'; | ||
import MainLayout from '../layouts/MainLayout.astro'; | ||
import { type CollectionEntry, getCollection } from "astro:content"; | ||
import MainLayout from "../layouts/MainLayout.astro"; | ||
export async function getStaticPaths() { | ||
const docs = await getCollection('docs'); | ||
return docs.map((entry) => ({ | ||
params: { | ||
slug: entry.slug, | ||
}, | ||
props: entry, | ||
})); | ||
const docs = await getCollection("docs"); | ||
return docs.map((entry) => ({ | ||
params: { | ||
slug: entry.slug, | ||
}, | ||
props: entry, | ||
})); | ||
} | ||
type Props = CollectionEntry<'docs'>; | ||
type Props = CollectionEntry<"docs">; | ||
const post = Astro.props; | ||
const { Content, headings } = await post.render(); | ||
--- | ||
|
||
<MainLayout headings={headings} {...post.data}> | ||
<Content /> | ||
<Content /> | ||
</MainLayout> |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
import { Image, Source } from "@unpic/astro"; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<meta name="generator" content={Astro.generator} /> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
<picture class="hero"> | ||
<!-- Large screens get a full-width hero image --> | ||
<Source | ||
src="https://images.unsplash.com/photo-1694406805270-f3a93e91f4b6" | ||
media="(min-width: 601px)" | ||
layout="fullWidth" | ||
/> | ||
<!-- Small screens get a constrained square image --> | ||
<Source | ||
src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364" | ||
media="(max-width: 600px)" | ||
width={600} | ||
height={600} | ||
/> | ||
<!-- Always include an Image as the final element --> | ||
<Image | ||
src="https://images.unsplash.com/photo-1693711942336-f4f9963bd364" | ||
width={600} | ||
height={600} | ||
alt="Aurora" | ||
unstyled | ||
/> | ||
</picture> | ||
|
||
<style> | ||
/* Style for all layouts */ | ||
.hero img { | ||
object-fit: cover; | ||
width: 100%; | ||
} | ||
|
||
@media (min-width: 601px) { | ||
/* Style for full-width layout */ | ||
.hero img { | ||
height: 600px; | ||
} | ||
} | ||
@media (max-width: 600px) { | ||
/* Style for constrained layout */ | ||
.hero img { | ||
max-width: 600px; | ||
aspect-ratio: 1/1; | ||
} | ||
} | ||
</style> | ||
</body> | ||
</html> |
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,24 @@ | ||
--- | ||
import { Image, Source } from "@unpic/astro"; | ||
const toy = | ||
"https://images.ctfassets.net/yadj1kx9rmg0/wtrHxeu3zEoEce2MokCSi/cf6f68efdcf625fdc060607df0f3baef/quwowooybuqbl6ntboz3.jpg"; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<meta name="generator" content={Astro.generator} /> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
<div> | ||
<picture> | ||
<Source src={toy} type="image/avif" width={800} height={600} /> | ||
<Source src={toy} type="image/webp" width={800} height={600} /> | ||
<Image src={toy} width={800} height={600} alt="Toy" /> | ||
</picture> | ||
</div> | ||
</body> | ||
</html> |
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 |
---|---|---|
@@ -1,3 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
/build | ||
/*.log | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
# Impala | ||
|
||
<p align="center"> | ||
<img src="https://user-images.githubusercontent.com/213306/227727009-a4dc391f-efb1-4489-ad73-c3d3a327704a.png" width="100" /> | ||
</p> | ||
|
||
Thanks for trying the pre-alpha of Impala. To get started, run the dev server: | ||
|
||
```bash | ||
npm run dev | ||
``` | ||
|
||
When you're ready to build for production, run: | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
See [the GitHub repo](https://githb.com/ascorbic/impala) for more help. |
Oops, something went wrong.