forked from mantinedev/mantine
/
Menu.demo.positionConfigurator.tsx
76 lines (72 loc) · 1.87 KB
/
Menu.demo.positionConfigurator.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import React from 'react';
import { Menu, MenuProps, Group } from '@mantine/core';
import { MantineDemo } from '@mantine/ds';
import { DemoMenuItems } from './_menu-items';
import { FLOATING_ARROW_POSITION_DATA } from '../../../shared/floating-position-data';
function Wrapper(props: MenuProps) {
return (
<Group position="center">
<Menu opened trigger="hover" {...props}>
<DemoMenuItems />
</Menu>
</Group>
);
}
const codeTemplate = (props: string) => `
import { Menu } from '@mantine/core';
function Demo() {
return (
<Menu${props}>
{/* Menu items */}
</Menu>
);
}
`;
export const positionConfigurator: MantineDemo = {
type: 'configurator',
component: Wrapper,
codeTemplate,
configurator: [
{
name: 'position',
type: 'select',
initialValue: 'bottom',
defaultValue: 'bottom',
data: [
{ label: 'bottom', value: 'bottom' },
{ label: 'bottom-start', value: 'bottom-start' },
{ label: 'bottom-end', value: 'bottom-end' },
{ label: 'top', value: 'top' },
{ label: 'top-start', value: 'top-start' },
{ label: 'top-end', value: 'top-end' },
{ label: 'left', value: 'left' },
{ label: 'left-start', value: 'left-start' },
{ label: 'left-end', value: 'left-end' },
{ label: 'right', value: 'right' },
{ label: 'right-start', value: 'right-start' },
{ label: 'right-end', value: 'right-end' },
],
},
{
name: 'offset',
type: 'number',
initialValue: 5,
defaultValue: 5,
max: 20,
min: -20,
},
{
name: 'withArrow',
type: 'boolean',
initialValue: false,
defaultValue: false,
},
{
name: 'arrowPosition',
type: 'select',
data: FLOATING_ARROW_POSITION_DATA,
initialValue: 'side',
defaultValue: 'side',
},
],
};