Skip to content

Commit af1ad10

Browse files
committed
feat: initial setup of the demonstration layout
1 parent cb0ba99 commit af1ad10

File tree

8 files changed

+74
-428
lines changed

8 files changed

+74
-428
lines changed

packages/ui/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ export * from './components/button';
22

33
export * from './components/card';
44

5+
export * from './components/tabs';
6+
57
export * from './types';
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use client';
2+
3+
import { usePathname } from 'next/navigation';
4+
import type { TabsOptionData } from 'soybean-react-ui';
5+
import { Tabs } from 'soybean-react-ui';
6+
7+
type DemoTabsProps = {
8+
items: TabsOptionData[];
9+
};
10+
11+
export default function DemoTabs({ items }: DemoTabsProps) {
12+
const pathname = usePathname();
13+
14+
const currentTab = pathname.split('/').pop();
15+
16+
return (
17+
<Tabs
18+
items={items}
19+
value={currentTab}
20+
/>
21+
);
22+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use client';
2+
import { usePathname } from 'next/navigation';
3+
4+
const DemoTitle = () => {
5+
const pathname = usePathname();
6+
7+
const currentTab = pathname.split('/').pop();
8+
9+
if (!currentTab) return null;
10+
11+
const title = currentTab.charAt(0).toUpperCase() + currentTab.slice(1);
12+
13+
return title;
14+
};
15+
16+
export default DemoTitle;

playground/src/app/button/page.tsx

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

0 commit comments

Comments
 (0)