Skip to content

Commit bc66743

Browse files
authored
Merge pull request #394 from RylanBot/feat/showcase
feat: add a showcase page
2 parents 57b75ef + 374eb0f commit bc66743

File tree

7 files changed

+103
-4
lines changed

7 files changed

+103
-4
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
interface CardProps {
2+
name: string;
3+
cover: string;
4+
description: string;
5+
link: string;
6+
}
7+
8+
const Card: React.FC<CardProps> = ({ name, cover, description, link }) => {
9+
return (
10+
<a href={link} target="_blank" rel="noopener noreferrer">
11+
<div className="w-72 rounded-lg shadow-md bg-white dark:bg-slate-700 hover:scale-105 transition-transform duration-300">
12+
<img src={cover} className="w-full h-42 object-cover" />
13+
<div className="h-32 p-4 flex flex-col">
14+
<p className="text-xl font-semibold text-blue-600 dark:text-blue-200">
15+
{name}
16+
</p>
17+
<p className="mt-1 text-gray-600 dark:text-white line-clamp-3">
18+
{description}
19+
</p>
20+
</div>
21+
</div>
22+
</a>
23+
);
24+
};
25+
26+
interface ShowcaseCardsProps {
27+
cases: CardProps[];
28+
}
29+
30+
const ShowcaseCards: React.FC<ShowcaseCardsProps> = ({ cases }) => {
31+
return (
32+
<div className="flex flex-wrap">
33+
{cases?.map((item, index) => (
34+
<div key={index} className="mx-8 my-6">
35+
<Card
36+
name={item.name}
37+
cover={item.cover}
38+
description={item.description}
39+
link={item.link}
40+
/>
41+
</div>
42+
))}
43+
</div>
44+
);
45+
};
46+
47+
export default ShowcaseCards;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default [
2+
{
3+
name: 'Melody Canvas',
4+
cover:
5+
'https://raw.githubusercontent.com/RylanBot/melody-canvas/refs/heads/main/public/image/preview.png',
6+
description:
7+
'An audio visualization editor that supports customizable effects and uses WebAV for video export.',
8+
link: 'https://github.com/RylanBot/melody-canvas',
9+
},
10+
];

doc-site/docs/showcase/data.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export default [
2+
{
3+
name: 'Melody Canvas',
4+
cover:
5+
'https://raw.githubusercontent.com/RylanBot/melody-canvas/refs/heads/main/public/image/preview.png',
6+
description:
7+
'音频可视化编辑器,支持自定义多种属性,采用 WebAV 导出视频效果。',
8+
link: 'https://github.com/RylanBot/melody-canvas',
9+
},
10+
];
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
nav:
3+
title: Showcase
4+
order: 5
5+
sidebar: false
6+
---
7+
8+
```tsx
9+
/**
10+
* inline: true
11+
*/
12+
import ShowcaseCards from './ShowcaseCards.tsx';
13+
import data from './data.en-US.ts';
14+
15+
export default () => <ShowcaseCards cases={data} />;
16+
```

doc-site/docs/showcase/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
nav:
3+
title: 案例
4+
order: 5
5+
sidebar: false
6+
---
7+
8+
```tsx
9+
/**
10+
* inline: true
11+
*/
12+
import ShowcaseCards from './ShowcaseCards.tsx';
13+
import data from './data.ts';
14+
15+
export default () => <ShowcaseCards cases={data} />;
16+
```

doc-site/tailwind.config.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module.exports = {
22
theme: {},
3+
darkMode: ['selector', '[data-prefers-color="dark"]'],
34
variants: {},
45
plugins: [],
5-
content: [
6-
'./docs/**/*.{tsx,md}',
7-
],
8-
}
6+
content: ['./docs/**/*.{tsx,md}'],
7+
};

doc-site/tailwind.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
@tailwind base;
12
@tailwind components;
23
@tailwind utilities;

0 commit comments

Comments
 (0)