From 6800e399ed670a1535b18446e4f308e83a6cf918 Mon Sep 17 00:00:00 2001 From: Tony Sullivan Date: Mon, 18 Sep 2023 12:50:14 -0500 Subject: [PATCH] some basic view transition support --- .../social-feed/src/components/Article.astro | 16 +++++-- .../src/components/ArticleHeader.astro | 4 +- .../social-feed/src/components/Card.astro | 30 ++++++++++--- .../src/components/SplitLayout.astro | 11 ++--- examples/social-feed/src/layouts/Base.astro | 42 +++++++++++-------- .../social-feed/src/pages/post/[slug].astro | 19 ++++++--- examples/social-feed/src/style/theme.css | 5 +++ 7 files changed, 84 insertions(+), 43 deletions(-) diff --git a/examples/social-feed/src/components/Article.astro b/examples/social-feed/src/components/Article.astro index 369f5c47c..e7491cda0 100644 --- a/examples/social-feed/src/components/Article.astro +++ b/examples/social-feed/src/components/Article.astro @@ -1,6 +1,6 @@ --- import ArticleHeader from './ArticleHeader.astro'; -import type { Article, Post } from '../content/config.js'; +import type { Article } from '../content/config.js'; export interface Props { article: Article; @@ -13,9 +13,9 @@ const { Content } = await article.render();
-
- -
+
+ +
diff --git a/examples/social-feed/src/components/SplitLayout.astro b/examples/social-feed/src/components/SplitLayout.astro index 130940326..40137474e 100644 --- a/examples/social-feed/src/components/SplitLayout.astro +++ b/examples/social-feed/src/components/SplitLayout.astro @@ -16,20 +16,17 @@ const { reverse = false, class: className, ...attrs } = Astro.props; div { display: flex; flex-direction: column; + align-items: center; gap: var(--theme-space-lg); margin: 0 auto; width: 100%; - max-width: var(--theme-content-width); + max-width: var(--theme-size-content-3); } @media (min-width: 50em) { div { - display: grid; - grid-template-columns: 12rem 1fr; - } - - div.reverse { - grid-template-columns: 1fr 12rem; + flex-direction: row; + align-items: initial; } } diff --git a/examples/social-feed/src/layouts/Base.astro b/examples/social-feed/src/layouts/Base.astro index f2be423cb..b71ed924b 100644 --- a/examples/social-feed/src/layouts/Base.astro +++ b/examples/social-feed/src/layouts/Base.astro @@ -1,4 +1,5 @@ --- +import { ViewTransitions } from 'astro:transitions'; import settings from '../settings'; import '../style/theme.css'; import '../style/global.css'; @@ -22,6 +23,7 @@ const { title = settings.name } = Astro.props; {title} + @@ -63,23 +65,27 @@ const { title = settings.name } = Astro.props; @@ -68,12 +72,15 @@ const { title } = isArticle(post) && post.data; .card { width: 100%; - max-width: 60ch; - margin-inline: auto; - padding-block: var(--theme-space-md); + margin: var(--theme-space-md) auto; } - .prev, .next { + .center { + margin-inline: auto; + } + + .prev, + .next { display: flex; align-items: center; gap: 0.5rem; diff --git a/examples/social-feed/src/style/theme.css b/examples/social-feed/src/style/theme.css index 9d5fb81b0..78c752ca5 100644 --- a/examples/social-feed/src/style/theme.css +++ b/examples/social-feed/src/style/theme.css @@ -26,6 +26,11 @@ --theme-shadow-md: 2px 2px 10px rgba(0, 0, 0, 0.1); --theme-shadow-lg: 2px 2px 20px rgba(0, 0, 0, 0.2); + /* Content Sizes */ + --theme-size-content-1: 30ch; + --theme-size-content-2: 45ch; + --theme-size-content-3: 65ch; + /* Type Scale */ /* @link https://utopia.fyi/type/calculator?c=320,16,1.2,1240,20,1.2,5,2,&s=0.75|0.5|0.25,1.5|2|3|4|6,s-l&g=s,l,xl,12 */ --theme-text-sm: clamp(0.83rem, calc(0.76rem + 0.36vw), 1.04rem);