agroptima-design-system 1.1.2 → 1.1.3-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/atoms/Menu/Menu.scss +30 -6
- package/src/stories/Changelog.mdx +4 -0
- package/src/stories/Menu.stories.tsx +24 -0
- package/tests/Menu.spec.tsx +26 -0
package/package.json
CHANGED
package/src/atoms/Menu/Menu.scss
CHANGED
|
@@ -54,14 +54,13 @@
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
details[open] {
|
|
58
|
-
|
|
59
|
-
transform: rotate(180deg);
|
|
60
|
-
}
|
|
57
|
+
details[open]>.menu-item .arrow {
|
|
58
|
+
transform: rotate(180deg);
|
|
61
59
|
}
|
|
60
|
+
|
|
62
61
|
.menu-dropdown .menu {
|
|
63
62
|
.menu-item {
|
|
64
|
-
padding-left: config.$space-
|
|
63
|
+
padding-left: config.$space-3x;
|
|
65
64
|
background: var(--neutral-color-100);
|
|
66
65
|
color: var(--neutral-color-1000);
|
|
67
66
|
|
|
@@ -69,12 +68,37 @@
|
|
|
69
68
|
background: var(--primary-color-100);
|
|
70
69
|
}
|
|
71
70
|
}
|
|
71
|
+
|
|
72
|
+
.arrow > svg {
|
|
73
|
+
fill: var(--primary-color-100);
|
|
74
|
+
path {
|
|
75
|
+
fill: var(--primary-color-100);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
72
79
|
.active {
|
|
73
80
|
background: var(--primary-color-100);
|
|
74
|
-
box-shadow: inset -3px 0px 0px 0px var(--primary-color-
|
|
81
|
+
box-shadow: inset -3px 0px 0px 0px var(--primary-color-100);
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
84
|
|
|
85
|
+
.menu-dropdown .menu .menu-dropdown .menu{
|
|
86
|
+
.menu-item {
|
|
87
|
+
padding-left: config.$space-8x;
|
|
88
|
+
background: var(--neutral-color-50);
|
|
89
|
+
color: var(--neutral-color-1000);
|
|
90
|
+
|
|
91
|
+
&:hover {
|
|
92
|
+
background: var(--primary-color-100);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.active {
|
|
97
|
+
background: var(--primary-color-100);
|
|
98
|
+
box-shadow: inset -3px 0px 0px 0px var(--primary-color-100);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
78
102
|
.menu-item::-webkit-details-marker {
|
|
79
103
|
display: none;
|
|
80
104
|
}
|
|
@@ -75,6 +75,30 @@ export const MenuWithLinks: Story = {
|
|
|
75
75
|
<MenuLink title="Dark souls" href="some-link" />
|
|
76
76
|
<MenuLink title="Elder ring" href="some-link" />
|
|
77
77
|
</MenuDropdown>
|
|
78
|
+
<MenuDropdown
|
|
79
|
+
title="Three level menu"
|
|
80
|
+
icon="AddCircle"
|
|
81
|
+
name="menu"
|
|
82
|
+
isOpen
|
|
83
|
+
>
|
|
84
|
+
<MenuDropdown title="Second Level" name="submenu">
|
|
85
|
+
<MenuLink title="Third Level 1" href="some-link" />
|
|
86
|
+
<MenuLink title="Third Level 2" href="some-link" />
|
|
87
|
+
</MenuDropdown>
|
|
88
|
+
</MenuDropdown>
|
|
89
|
+
</Menu>
|
|
90
|
+
),
|
|
91
|
+
}
|
|
92
|
+
export const MenuThirdLevel: Story = {
|
|
93
|
+
render: () => (
|
|
94
|
+
<Menu>
|
|
95
|
+
<MenuDropdown title="Final Fantasy" icon="AddCircle" name="menu" isOpen>
|
|
96
|
+
<MenuDropdown title="Bestiary" name="submenu">
|
|
97
|
+
<MenuLink title="Chocobo" href="some-link" />
|
|
98
|
+
<MenuLink title="Moguri" href="some-link" isActive />
|
|
99
|
+
</MenuDropdown>
|
|
100
|
+
</MenuDropdown>
|
|
101
|
+
<MenuLink title="Metroid" icon="Delete" href="#" />
|
|
78
102
|
</Menu>
|
|
79
103
|
),
|
|
80
104
|
}
|
package/tests/Menu.spec.tsx
CHANGED
|
@@ -54,4 +54,30 @@ describe('Menu', () => {
|
|
|
54
54
|
expect(getByRole('img', { name: 'AngleDown' })).toBeInTheDocument()
|
|
55
55
|
expect(getByRole('img', { name: 'Delete' })).toBeInTheDocument()
|
|
56
56
|
})
|
|
57
|
+
it('renders third-level menu', () => {
|
|
58
|
+
const { getAllByRole, getByText } = render(
|
|
59
|
+
<Menu>
|
|
60
|
+
<MenuDropdown title="Final Fantasy">
|
|
61
|
+
<MenuDropdown title="Final Fantasy VIII">
|
|
62
|
+
<MenuLink title="Walkthrough" href="#" />
|
|
63
|
+
<MenuLink title="Characters" href="#" />
|
|
64
|
+
<MenuLink title="Story" href="#" />
|
|
65
|
+
</MenuDropdown>
|
|
66
|
+
</MenuDropdown>
|
|
67
|
+
<MenuLink
|
|
68
|
+
title="The Legend of Zelda: Tears of the Kingdom"
|
|
69
|
+
icon="Delete"
|
|
70
|
+
href="#"
|
|
71
|
+
/>
|
|
72
|
+
</Menu>,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
expect(getAllByRole('menu').length).toBe(3)
|
|
76
|
+
expect(getByText('Final Fantasy')).toBeInTheDocument()
|
|
77
|
+
expect(getByText(/VIII/i)).toBeInTheDocument()
|
|
78
|
+
expect(getByText(/Walkthrough/i)).toBeInTheDocument()
|
|
79
|
+
expect(getByText(/Characters/i)).toBeInTheDocument()
|
|
80
|
+
expect(getByText(/Story/i)).toBeInTheDocument()
|
|
81
|
+
expect(getByText(/Zelda/i)).toBeInTheDocument()
|
|
82
|
+
})
|
|
57
83
|
})
|