Skip to content

Commit efc0d29

Browse files
committed
chore: update
1 parent f5bb59e commit efc0d29

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

stories/BlogBackButton.stories.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import { BlogBackButton } from '@rstack-dev/doc-ui/blog-back-button';
2+
import type { ReactNode } from 'react';
3+
import './index.scss';
4+
5+
type StoryLinkProps = {
6+
className: string;
7+
href: string;
8+
children: ReactNode;
9+
target?: string;
10+
rel?: string;
11+
onMouseEnter?: () => void;
12+
onMouseLeave?: () => void;
13+
[key: `data-${string}`]: string | undefined;
14+
};
15+
16+
const StoryLink = ({ children, ...props }: StoryLinkProps) => {
17+
return <a {...props}>{children}</a>;
18+
};
19+
20+
export const BlogBackButtonStory = () => (
21+
<div style={{ margin: '0 auto', maxWidth: 960, padding: 24 }}>
22+
<BlogBackButton pathname="/blog/rspress-2-0" LinkComp={StoryLink} />
23+
<div style={{ marginBottom: 24 }}>English blog detail page</div>
24+
25+
<BlogBackButton
26+
pathname="/zh/blog/rspack-roadmap"
27+
lang="zh"
28+
LinkComp={StoryLink}
29+
/>
30+
<div>中文博客详情页</div>
31+
</div>
32+
);
33+
34+
export default {
35+
title: 'BlogBackButton',
36+
};

stories/BlogList.stories.tsx

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
import type { BlogAvatarAuthor } from '@rstack-dev/doc-ui/blog-avatar';
2+
import { BlogBackground } from '@rstack-dev/doc-ui/blog-background';
23
import { BlogList, type BlogListItem } from '@rstack-dev/doc-ui/blog-list';
4+
import type { ReactNode } from 'react';
35
import './index.scss';
46

7+
type StoryLinkProps = {
8+
className: string;
9+
href: string;
10+
children: ReactNode;
11+
target?: string;
12+
rel?: string;
13+
onMouseEnter?: () => void;
14+
onMouseLeave?: () => void;
15+
[key: `data-${string}`]: string | undefined;
16+
};
17+
18+
const StoryLink = ({ children, ...props }: StoryLinkProps) => {
19+
return <a {...props}>{children}</a>;
20+
};
21+
522
const renderInlineMarkdown = (content: string) => {
623
return { children: content };
724
};
@@ -76,6 +93,36 @@ export const BlogListStory = () => (
7693
</div>
7794
);
7895

96+
export const BlogListWithBackgroundStory = () => (
97+
<div style={{ margin: '0 auto', maxWidth: 1040, padding: 24 }}>
98+
<div style={{ position: 'relative', zIndex: 0 }}>
99+
<BlogList
100+
posts={posts}
101+
locale="en-US"
102+
LinkComp={StoryLink}
103+
renderInlineMarkdown={renderInlineMarkdown}
104+
showBackground={false}
105+
title="Blog"
106+
subtitle={
107+
<>
108+
Release notes and official announcements from the Rstack team.
109+
Follow{' '}
110+
<a
111+
href="https://x.com/rspack_dev"
112+
target="_blank"
113+
rel="noopener noreferrer"
114+
>
115+
@rspack_dev
116+
</a>{' '}
117+
to stay up to date.
118+
</>
119+
}
120+
/>
121+
<BlogBackground />
122+
</div>
123+
</div>
124+
);
125+
79126
export default {
80127
title: 'BlogList',
81128
};

0 commit comments

Comments
 (0)