Skip to content

Commit 80b0f9e

Browse files
committed
chore: init docs
1 parent 87e82fa commit 80b0f9e

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

docs/demos/mobile.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Mobile
3+
nav:
4+
title: Demo
5+
path: /demo
6+
---
7+
8+
<code src="../examples/mobile.tsx"></code>

docs/examples/mobile.tsx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import Trigger from '@rc-component/trigger';
2+
import React from 'react';
3+
import '../../assets/index.less';
4+
5+
const builtinPlacements = {
6+
left: {
7+
points: ['cr', 'cl'],
8+
},
9+
right: {
10+
points: ['cl', 'cr'],
11+
},
12+
top: {
13+
points: ['bc', 'tc'],
14+
},
15+
bottom: {
16+
points: ['tc', 'bc'],
17+
},
18+
topLeft: {
19+
points: ['bl', 'tl'],
20+
},
21+
topRight: {
22+
points: ['br', 'tr'],
23+
},
24+
bottomRight: {
25+
points: ['tr', 'br'],
26+
},
27+
bottomLeft: {
28+
points: ['tl', 'bl'],
29+
},
30+
};
31+
32+
const Test = () => {
33+
const [open1, setOpen1] = React.useState(false);
34+
35+
return (
36+
<div style={{ margin: 200 }}>
37+
<div>
38+
<Trigger
39+
popupPlacement="right"
40+
action={['click']}
41+
builtinPlacements={builtinPlacements}
42+
popupVisible={open1}
43+
onOpenChange={setOpen1}
44+
popup={
45+
<div>
46+
<h2>Hello World</h2>
47+
</div>
48+
}
49+
mobile
50+
>
51+
<span>Click Me</span>
52+
</Trigger>
53+
</div>
54+
</div>
55+
);
56+
};
57+
58+
export default Test;

0 commit comments

Comments
 (0)