Skip to content

Commit 7c3d54a

Browse files
r-farkhutdinovRuslan Farkhutdinov
andauthored
Menu: Add margin-left in vertical mode for Fluent and Material (DevExpress#29068)
Co-authored-by: Ruslan Farkhutdinov <[email protected]>
1 parent b5435fe commit 7c3d54a

12 files changed

+140
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from 'react';
2+
import { Menu, MenuTypes } from 'devextreme-react/menu';
3+
import type { Meta, StoryObj } from '@storybook/react';
4+
import { menuItems } from './data';
5+
6+
const meta: Meta<typeof Menu> = {
7+
title: 'Components/Menu',
8+
component: Menu,
9+
parameters: {
10+
layout: 'fullscreen',
11+
}
12+
};
13+
14+
type Story = StoryObj<typeof Menu>;
15+
16+
const showSubmenuModes= ['onClick', 'onHover'] as const;
17+
const submenuDirectionOptions = ['auto', 'leftOrTop', 'rightOrBottom'] as const;
18+
19+
const commonArgs: Story['args'] = {
20+
showFirstSubmenuMode: showSubmenuModes[0],
21+
submenuDirection: submenuDirectionOptions[0],
22+
hideSubmenuOnMouseLeave: false,
23+
adaptivityEnabled: false,
24+
};
25+
26+
const argTypes = {
27+
showFirstSubmenuMode: {
28+
control: 'select',
29+
options: showSubmenuModes,
30+
},
31+
submenuDirection: {
32+
control: 'select',
33+
options: submenuDirectionOptions,
34+
},
35+
hideSubmenuOnMouseLeave: {
36+
control: 'boolean',
37+
},
38+
adaptivityEnabled: {
39+
control: 'boolean',
40+
},
41+
};
42+
43+
export default meta;
44+
45+
const createMenuStory = (orientation: MenuTypes.Orientation): Story => ({
46+
args: { ...commonArgs, orientation },
47+
argTypes,
48+
render: (args) => <Menu dataSource={menuItems} {...args} />,
49+
});
50+
51+
export const Horizontal: Story = createMenuStory('horizontal');
52+
export const Vertical: Story = createMenuStory('vertical');
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
export const menuItems = [{
2+
id: '1',
3+
text: 'Video Players',
4+
items: [{
5+
id: '1_1',
6+
text: 'HD Video Player',
7+
price: 220,
8+
icon: 'images/products/1-small.png',
9+
}, {
10+
id: '1_2',
11+
text: 'SuperHD Video Player',
12+
icon: 'images/products/2-small.png',
13+
price: 270,
14+
}],
15+
}, {
16+
id: '2',
17+
text: 'Televisions',
18+
items: [{
19+
id: '2_1',
20+
text: 'SuperLCD 42',
21+
icon: 'images/products/5-small.png',
22+
price: 1200,
23+
}, {
24+
id: '2_2',
25+
text: 'SuperLED 42',
26+
icon: 'images/products/5-small.png',
27+
price: 1450,
28+
}, {
29+
id: '2_3',
30+
text: 'SuperLED 50',
31+
icon: 'images/products/5-small.png',
32+
price: 1600,
33+
}, {
34+
id: '2_4',
35+
text: 'SuperLCD 55 (Not available)',
36+
icon: 'images/products/5-small.png',
37+
price: 1350,
38+
disabled: true,
39+
}, {
40+
id: '2_5',
41+
text: 'SuperLCD 70',
42+
icon: 'images/products/5-small.png',
43+
price: 4000,
44+
}],
45+
}, {
46+
id: '3',
47+
text: 'Monitors',
48+
items: [{
49+
id: '3_1',
50+
text: '19"',
51+
items: [{
52+
id: '3_1_1',
53+
text: 'DesktopLCD 19',
54+
icon: 'images/products/5-small.png',
55+
price: 160,
56+
}],
57+
}, {
58+
id: '3_2',
59+
text: '21"',
60+
items: [{
61+
id: '3_2_1',
62+
text: 'DesktopLCD 21',
63+
icon: 'images/products/5-small.png',
64+
price: 170,
65+
}, {
66+
id: '3_2_2',
67+
text: 'DesktopLED 21',
68+
icon: 'images/products/5-small.png',
69+
price: 175,
70+
}],
71+
}],
72+
}, {
73+
id: '4',
74+
text: 'Projectors',
75+
items: [{
76+
id: '4_1',
77+
text: 'Projector Plus',
78+
icon: 'images/products/5-small.png',
79+
price: 550,
80+
}, {
81+
id: '4_2',
82+
text: 'Projector PlusHD',
83+
icon: 'images/products/5-small.png',
84+
price: 750,
85+
}],
86+
}];
11 Bytes
Loading
-292 Bytes
Loading
Loading
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)