Skip to content

Commit f298988

Browse files
feat(react, plugin-history-sync): Default history setup option for rich deep link experiences (#610)
1 parent 39f339e commit f298988

39 files changed

+725
-203
lines changed

.changeset/chubby-pianos-heal.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@stackflow/react": minor
3+
---
4+
5+
`StructuredActivityComponentType` is added.
6+
7+
Structured activity components are components modeling activity view while exposing major features of an activity.
8+
Allowing developers easily customize user experience of an activity view, it even allow stackflow to perform various kinds of optimizations.

.changeset/gold-groups-own.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-preload": patch
3+
---
4+
5+
Sync with type constraint changes in stackflow/react

.changeset/new-pandas-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@stackflow/plugin-history-sync": minor
3+
---
4+
5+
Add `defaultHistory` route option to pre-seed stack for better deep link experiences

demo/src/activities/Article.tsx

Lines changed: 0 additions & 65 deletions
This file was deleted.

demo/src/activities/Article.css.ts renamed to demo/src/activities/Article/Article.content.css.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { vars } from "@seed-design/design-token";
22
import { style } from "@vanilla-extract/css";
33

4-
import { f } from "../styles";
4+
import { f } from "../../styles";
55

66
export const container = style([
77
f.posAbsFull,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import {
2+
content,
3+
useActivityParams,
4+
useLoaderData,
5+
} from "@stackflow/react/future";
6+
import { LazyLoadImage } from "react-lazy-load-image-component";
7+
import ArticleCard from "../../components/ArticleCard";
8+
import ArticleProfile from "../../components/ArticleProfile";
9+
import * as css from "./Article.content.css";
10+
import type { articleLoader } from "./Article.loader";
11+
12+
const ArticleContent = content<"Article">(() => {
13+
const { title } = useActivityParams<"Article">();
14+
const { imageUrl, recommenderCards } = useLoaderData<typeof articleLoader>();
15+
16+
return (
17+
<div className={css.container}>
18+
<div className={css.image}>
19+
<div className={css.imageInner}>
20+
<LazyLoadImage
21+
src={imageUrl}
22+
effect="opacity"
23+
width="100%"
24+
height="100%"
25+
/>
26+
</div>
27+
</div>
28+
<ArticleProfile />
29+
<div className={css.content}>
30+
<div className={css.title}>{title}</div>
31+
<div className={css.subtitle}>Baby & Kids 3 days ago</div>
32+
<div className={css.body}>
33+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean
34+
elementum sit sem ullamcorper urna, lacinia eu tortor, mattis.
35+
Venenatis ut cursus amet in.
36+
</div>
37+
<div className={css.subtitle}>1 chats ∙ 2 favorites ∙ 212 views</div>
38+
</div>
39+
<div className={css.section}>
40+
<div className={css.sectionTitle}>Other Items by Emila </div>
41+
<div className={css.recommenderGrid}>
42+
{recommenderCards.map((card) => (
43+
<ArticleCard key={card.articleId} {...card} />
44+
))}
45+
</div>
46+
</div>
47+
</div>
48+
);
49+
});
50+
51+
export default ArticleContent;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { layout } from "@stackflow/react/future";
2+
import Layout from "../../components/Layout";
3+
4+
const ArticleLayout = layout<"Article">(({ params: { title }, children }) => {
5+
return <Layout appBar={{ title }}>{children}</Layout>;
6+
});
7+
8+
export default ArticleLayout;
File renamed without changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { style } from "@vanilla-extract/css";
2+
3+
export const container = style({
4+
display: "flex",
5+
alignItems: "center",
6+
justifyContent: "center",
7+
height: "100%",
8+
width: "100%",
9+
});
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { loading } from "@stackflow/react/future";
2+
import LoadingSpinner from "../../components/LoadingSpinner";
3+
4+
import * as css from "./Article.loading.css";
5+
6+
const ArticleLoading = loading<"Article">(() => {
7+
return (
8+
<div className={css.container}>
9+
<LoadingSpinner />
10+
</div>
11+
);
12+
});
13+
14+
export default ArticleLoading;

0 commit comments

Comments
 (0)