@redocly/theme 0.15.1 → 0.16.0

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.
Files changed (345) hide show
  1. package/lib/I18n/LanguagePicker.js +2 -1
  2. package/lib/components/Breadcrumbs/Breadcrumb.js +0 -1
  3. package/lib/components/Breadcrumbs/Breadcrumbs.js +6 -0
  4. package/lib/components/Cards/Card.d.ts +1 -0
  5. package/lib/components/Cards/Card.js +1 -1
  6. package/lib/components/Cards/CardsBlock.d.ts +1 -3
  7. package/lib/components/Cards/CardsBlock.js +2 -1
  8. package/lib/components/Catalog/Catalog.js +1 -1
  9. package/lib/components/CodeBlock/CodeBlock.d.ts +1 -3
  10. package/lib/components/CodeBlock/CodeBlock.js +2 -1
  11. package/lib/components/CodeSample/CodeSample.d.ts +2 -1
  12. package/lib/components/CodeSample/CodeSample.js +3 -2
  13. package/lib/components/ColorModeSwitcher/ColorModeSwitcher.d.ts +5 -1
  14. package/lib/components/ColorModeSwitcher/ColorModeSwitcher.js +3 -2
  15. package/lib/components/Feedback/Comment.d.ts +1 -1
  16. package/lib/components/Feedback/Comment.js +3 -3
  17. package/lib/components/Feedback/Rating.d.ts +1 -1
  18. package/lib/components/Feedback/Rating.js +2 -2
  19. package/lib/components/Feedback/Reasons.d.ts +1 -1
  20. package/lib/components/Feedback/Reasons.js +2 -2
  21. package/lib/components/Feedback/ReportDialog.js +1 -1
  22. package/lib/components/Feedback/Sentiment.d.ts +1 -1
  23. package/lib/components/Feedback/Sentiment.js +2 -2
  24. package/lib/components/Feedback/types.d.ts +5 -0
  25. package/lib/components/Footer/CustomFooter.d.ts +2 -1
  26. package/lib/components/Footer/CustomFooter.js +2 -2
  27. package/lib/components/Footer/CustomFooterNavItem.d.ts +2 -1
  28. package/lib/components/Footer/CustomFooterNavItem.js +2 -2
  29. package/lib/components/Footer/Footer.d.ts +2 -1
  30. package/lib/components/Footer/Footer.js +2 -2
  31. package/lib/components/Footer/FooterColumn.d.ts +2 -1
  32. package/lib/components/Footer/FooterColumn.js +2 -2
  33. package/lib/components/Footer/FooterColumns.d.ts +2 -1
  34. package/lib/components/Footer/FooterColumns.js +2 -2
  35. package/lib/components/Footer/FooterCopyright.d.ts +2 -1
  36. package/lib/components/Footer/FooterCopyright.js +2 -2
  37. package/lib/components/JsonViewer/JsonViewer.d.ts +1 -3
  38. package/lib/components/LastUpdated/LastUpdated.d.ts +1 -0
  39. package/lib/components/LastUpdated/LastUpdated.js +1 -1
  40. package/lib/components/Markdown/ContainerWrapper.d.ts +1 -3
  41. package/lib/components/Markdown/ContainerWrapper.js +2 -1
  42. package/lib/components/Markdown/Heading.d.ts +2 -1
  43. package/lib/components/Markdown/Heading.js +2 -2
  44. package/lib/components/Markdown/MarkdownLayout.d.ts +2 -1
  45. package/lib/components/Markdown/MarkdownLayout.js +2 -2
  46. package/lib/components/Markdown/MarkdownWrapper.d.ts +1 -3
  47. package/lib/components/Markdown/MarkdownWrapper.js +2 -1
  48. package/lib/components/Markdown/Mermaid.d.ts +2 -1
  49. package/lib/components/Markdown/Mermaid.js +3 -2
  50. package/lib/components/Markdown/PageWrapper.d.ts +1 -3
  51. package/lib/components/Markdown/PageWrapper.js +2 -1
  52. package/lib/components/Markdown/Sup.d.ts +3 -1
  53. package/lib/components/Markdown/Sup.js +2 -2
  54. package/lib/components/Menu/Menu.d.ts +3 -1
  55. package/lib/components/Menu/Menu.js +6 -4
  56. package/lib/components/Menu/MenuContainer.d.ts +1 -0
  57. package/lib/components/Menu/MenuContainer.js +2 -1
  58. package/lib/components/Menu/MenuGroup.d.ts +2 -1
  59. package/lib/components/Menu/MenuGroup.js +3 -3
  60. package/lib/components/Menu/MenuItem.d.ts +1 -1
  61. package/lib/components/Menu/MenuItem.js +19 -3
  62. package/lib/components/Menu/MenuItemLabel.d.ts +1 -3
  63. package/lib/components/Menu/MenuItemLabel.js +18 -9
  64. package/lib/components/Menu/MenuItemSwitch.js +4 -2
  65. package/lib/components/Menu/MenuLink.d.ts +1 -3
  66. package/lib/components/Menu/MenuLink.js +2 -1
  67. package/lib/components/Menu/MenuLinkItem.d.ts +1 -1
  68. package/lib/components/Menu/MenuLinkItem.js +2 -2
  69. package/lib/components/Menu/MobileMenu.d.ts +11 -0
  70. package/lib/components/Menu/MobileMenu.js +179 -0
  71. package/lib/components/Menu/MobileMenuGroup.d.ts +9 -0
  72. package/lib/components/Menu/MobileMenuGroup.js +53 -0
  73. package/lib/components/Menu/index.d.ts +1 -0
  74. package/lib/components/Menu/index.js +1 -0
  75. package/lib/components/Navbar/BurgerButton.d.ts +5 -0
  76. package/lib/components/Navbar/BurgerButton.js +29 -0
  77. package/lib/components/Navbar/MobileUserProfile.d.ts +2 -0
  78. package/lib/components/Navbar/MobileUserProfile.js +78 -0
  79. package/lib/components/Navbar/Navbar.d.ts +1 -0
  80. package/lib/components/Navbar/Navbar.js +29 -9
  81. package/lib/components/Navbar/NavbarDropdown.d.ts +2 -1
  82. package/lib/components/Navbar/NavbarDropdown.js +2 -2
  83. package/lib/components/Navbar/NavbarMenu.d.ts +2 -1
  84. package/lib/components/Navbar/NavbarMenu.js +2 -2
  85. package/lib/components/NavbarLogo/NavbarLogo.d.ts +2 -1
  86. package/lib/components/NavbarLogo/NavbarLogo.js +2 -2
  87. package/lib/components/OpenApiDocs/DevOnboardingTryItSecurity.d.ts +1 -1
  88. package/lib/components/OpenApiDocs/DevOnboardingTryItSecurity.js +1 -1
  89. package/lib/components/PageNavigation/NextButton.d.ts +2 -1
  90. package/lib/components/PageNavigation/NextButton.js +2 -2
  91. package/lib/components/PageNavigation/PageNavigation.d.ts +2 -1
  92. package/lib/components/PageNavigation/PageNavigation.js +2 -2
  93. package/lib/components/PageNavigation/PreviousButton.d.ts +2 -1
  94. package/lib/components/PageNavigation/PreviousButton.js +2 -2
  95. package/lib/components/Panel/PanelBody.d.ts +1 -3
  96. package/lib/components/Panel/PanelBody.js +2 -1
  97. package/lib/components/Panel/PanelHeader.d.ts +1 -3
  98. package/lib/components/Panel/PanelHeader.js +2 -1
  99. package/lib/components/Panel/PanelHeaderTitle.d.ts +1 -3
  100. package/lib/components/Panel/PanelHeaderTitle.js +2 -1
  101. package/lib/components/Profile/Profile.d.ts +6 -0
  102. package/lib/components/Profile/Profile.js +7 -7
  103. package/lib/components/Profile/types.d.ts +1 -0
  104. package/lib/components/SamplesPanelControls/SamplesPanelControls.d.ts +2 -6
  105. package/lib/components/SamplesPanelControls/SamplesPanelControls.js +2 -1
  106. package/lib/components/Search/CancelSearch.d.ts +2 -1
  107. package/lib/components/Search/CancelSearch.js +2 -2
  108. package/lib/components/Search/ClearIcon.d.ts +1 -3
  109. package/lib/components/Search/ClearIcon.js +2 -1
  110. package/lib/components/Search/ClockBackwardsIcon.d.ts +1 -4
  111. package/lib/components/Search/Input.d.ts +1 -3
  112. package/lib/components/Search/Input.js +2 -1
  113. package/lib/components/Search/InputWrapper.d.ts +2 -1
  114. package/lib/components/Search/InputWrapper.js +2 -2
  115. package/lib/components/Search/MobileSearchTrigger.d.ts +2 -1
  116. package/lib/components/Search/MobileSearchTrigger.js +6 -5
  117. package/lib/components/Search/Popover.d.ts +1 -3
  118. package/lib/components/Search/Popover.js +3 -2
  119. package/lib/components/Search/RecentSearches.d.ts +2 -1
  120. package/lib/components/Search/RecentSearches.js +3 -3
  121. package/lib/components/Search/Search.d.ts +3 -1
  122. package/lib/components/Search/Search.js +2 -2
  123. package/lib/components/Search/SearchDialog.d.ts +2 -1
  124. package/lib/components/Search/SearchDialog.js +4 -3
  125. package/lib/components/Search/SearchIcon.d.ts +1 -3
  126. package/lib/components/Search/SearchIcon.js +2 -1
  127. package/lib/components/Search/SearchItem.d.ts +2 -1
  128. package/lib/components/Search/SearchItem.js +3 -3
  129. package/lib/components/Search/SearchTrigger.d.ts +2 -1
  130. package/lib/components/Search/SearchTrigger.js +2 -2
  131. package/lib/components/Search/Shortcut.d.ts +2 -1
  132. package/lib/components/Search/Shortcut.js +2 -2
  133. package/lib/components/Search/ShortcutKey.d.ts +1 -0
  134. package/lib/components/Search/ShortcutKey.js +1 -1
  135. package/lib/components/Search/SidebarSearch.d.ts +1 -3
  136. package/lib/components/Search/SidebarSearch.js +2 -1
  137. package/lib/components/Search/SuggestedPages.d.ts +3 -1
  138. package/lib/components/Search/SuggestedPages.js +2 -2
  139. package/lib/components/Separator/Separator.d.ts +1 -1
  140. package/lib/components/Separator/Separator.js +2 -2
  141. package/lib/components/Separator/SeparatorItem.d.ts +1 -5
  142. package/lib/components/Separator/SeparatorItem.js +7 -2
  143. package/lib/components/Separator/SeparatorLine.d.ts +1 -3
  144. package/lib/components/Separator/SeparatorLine.js +2 -1
  145. package/lib/components/Sidebar/ApiCallItem.d.ts +1 -1
  146. package/lib/components/Sidebar/ApiCallItem.js +10 -3
  147. package/lib/components/Sidebar/BackButton.d.ts +2 -1
  148. package/lib/components/Sidebar/BackButton.js +2 -2
  149. package/lib/components/Sidebar/Drilldown.d.ts +2 -1
  150. package/lib/components/Sidebar/Drilldown.js +2 -2
  151. package/lib/components/Sidebar/DrilldownMenu.d.ts +1 -1
  152. package/lib/components/Sidebar/DrilldownMenu.js +3 -3
  153. package/lib/components/Sidebar/DrilldownMenuItem.d.ts +1 -1
  154. package/lib/components/Sidebar/DrilldownMenuItem.js +2 -2
  155. package/lib/components/Sidebar/HeaderWrapper.d.ts +1 -3
  156. package/lib/components/Sidebar/HeaderWrapper.js +2 -1
  157. package/lib/components/Sidebar/MobileSidebarButton.d.ts +1 -3
  158. package/lib/components/Sidebar/MobileSidebarButton.js +3 -2
  159. package/lib/components/Sidebar/Sidebar.d.ts +1 -3
  160. package/lib/components/Sidebar/Sidebar.js +2 -1
  161. package/lib/components/Sidebar/SidebarLayout.d.ts +2 -1
  162. package/lib/components/Sidebar/SidebarLayout.js +2 -4
  163. package/lib/components/Sidebar/types.d.ts +3 -0
  164. package/lib/components/SidebarActions/SidebarActions.d.ts +2 -1
  165. package/lib/components/SidebarActions/SidebarActions.js +2 -2
  166. package/lib/components/SidebarLogo/SidebarLogo.d.ts +2 -1
  167. package/lib/components/SidebarLogo/SidebarLogo.js +2 -2
  168. package/lib/components/TableOfContent/TableOfContent.d.ts +1 -0
  169. package/lib/components/TableOfContent/TableOfContent.js +2 -2
  170. package/lib/components/Tags/Tags.d.ts +2 -1
  171. package/lib/components/Tags/Tags.js +2 -2
  172. package/lib/components/Tiles/TileHeader.d.ts +1 -3
  173. package/lib/components/Tiles/TileHeader.js +2 -1
  174. package/lib/components/Tiles/TileText.d.ts +1 -3
  175. package/lib/components/Tiles/TileText.js +2 -1
  176. package/lib/components/Typography/CompactTypography.d.ts +1 -3
  177. package/lib/components/Typography/Emphasis.d.ts +1 -3
  178. package/lib/components/Typography/Emphasis.js +2 -1
  179. package/lib/components/Typography/H1.d.ts +1 -3
  180. package/lib/components/Typography/H1.js +2 -1
  181. package/lib/components/Typography/H2.d.ts +1 -3
  182. package/lib/components/Typography/H2.js +2 -1
  183. package/lib/components/Typography/H3.d.ts +1 -3
  184. package/lib/components/Typography/H3.js +2 -1
  185. package/lib/components/Typography/SectionHeader.d.ts +1 -3
  186. package/lib/components/Typography/SectionHeader.js +2 -1
  187. package/lib/components/Typography/Typography.d.ts +1 -3
  188. package/lib/components/Typography/Typography.js +2 -1
  189. package/lib/globalStyle.js +62 -2
  190. package/lib/hooks/useMobileMenu.js +7 -1
  191. package/lib/icons/BurgerIcon/BurgerIcon.d.ts +5 -0
  192. package/lib/icons/BurgerIcon/BurgerIcon.js +15 -0
  193. package/lib/icons/BurgerIcon/index.d.ts +1 -0
  194. package/lib/icons/BurgerIcon/index.js +6 -0
  195. package/lib/icons/CloseIcon/CloseIcon.d.ts +5 -0
  196. package/lib/icons/CloseIcon/CloseIcon.js +16 -0
  197. package/lib/icons/CloseIcon/index.d.ts +1 -0
  198. package/lib/icons/CloseIcon/index.js +6 -0
  199. package/lib/icons/ColorModeIcon/ColorModeIcon.js +5 -1
  200. package/lib/icons/ExpandIcon/ExpandIcon.d.ts +8 -0
  201. package/lib/icons/ExpandIcon/ExpandIcon.js +31 -0
  202. package/lib/icons/ExpandIcon/index.d.ts +1 -0
  203. package/lib/icons/ExpandIcon/index.js +6 -0
  204. package/lib/icons/LogoutIcon/LogoutIcon.d.ts +5 -0
  205. package/lib/icons/LogoutIcon/LogoutIcon.js +17 -0
  206. package/lib/icons/LogoutIcon/index.d.ts +1 -0
  207. package/lib/icons/LogoutIcon/index.js +6 -0
  208. package/lib/icons/index.d.ts +4 -0
  209. package/lib/icons/index.js +4 -0
  210. package/lib/mocks/Sidebar/useSidebarItems.d.ts +3 -0
  211. package/lib/mocks/Sidebar/useSidebarItems.js +8 -0
  212. package/lib/mocks/hooks/index.d.ts +4 -1
  213. package/lib/mocks/hooks/index.js +16 -1
  214. package/lib/mocks/media-css.d.ts +5 -0
  215. package/lib/mocks/media-css.js +5 -0
  216. package/lib/ui/Dropdown.js +1 -1
  217. package/lib/ui/darkColors.js +11 -3
  218. package/package.json +4 -3
  219. package/src/I18n/LanguagePicker.tsx +2 -1
  220. package/src/components/Breadcrumbs/Breadcrumb.tsx +0 -1
  221. package/src/components/Breadcrumbs/Breadcrumbs.tsx +6 -0
  222. package/src/components/Cards/Card.tsx +2 -1
  223. package/src/components/Cards/CardsBlock.tsx +2 -1
  224. package/src/components/Catalog/Catalog.tsx +1 -1
  225. package/src/components/CodeBlock/CodeBlock.ts +2 -1
  226. package/src/components/CodeSample/CodeSample.tsx +4 -1
  227. package/src/components/ColorModeSwitcher/ColorModeSwitcher.tsx +7 -1
  228. package/src/components/Feedback/Comment.tsx +3 -3
  229. package/src/components/Feedback/Rating.tsx +2 -2
  230. package/src/components/Feedback/Reasons.tsx +6 -2
  231. package/src/components/Feedback/ReportDialog.tsx +1 -1
  232. package/src/components/Feedback/Sentiment.tsx +2 -2
  233. package/src/components/Feedback/types.ts +5 -0
  234. package/src/components/Footer/CustomFooter.tsx +3 -2
  235. package/src/components/Footer/CustomFooterNavItem.tsx +3 -2
  236. package/src/components/Footer/Footer.tsx +3 -1
  237. package/src/components/Footer/FooterColumn.tsx +3 -2
  238. package/src/components/Footer/FooterColumns.tsx +3 -2
  239. package/src/components/Footer/FooterCopyright.tsx +6 -1
  240. package/src/components/LastUpdated/LastUpdated.tsx +2 -0
  241. package/src/components/Markdown/ContainerWrapper.tsx +2 -1
  242. package/src/components/Markdown/Heading.tsx +3 -1
  243. package/src/components/Markdown/MarkdownLayout.tsx +3 -1
  244. package/src/components/Markdown/MarkdownWrapper.tsx +2 -1
  245. package/src/components/Markdown/Mermaid.tsx +5 -1
  246. package/src/components/Markdown/PageWrapper.tsx +2 -1
  247. package/src/components/Markdown/Sup.tsx +9 -2
  248. package/src/components/Menu/Menu.tsx +16 -5
  249. package/src/components/Menu/MenuContainer.tsx +3 -1
  250. package/src/components/Menu/MenuGroup.tsx +4 -5
  251. package/src/components/Menu/MenuItem.tsx +22 -4
  252. package/src/components/Menu/MenuItemLabel.tsx +19 -10
  253. package/src/components/Menu/MenuItemSwitch.tsx +7 -5
  254. package/src/components/Menu/MenuLink.tsx +2 -1
  255. package/src/components/Menu/MenuLinkItem.tsx +2 -1
  256. package/src/components/Menu/MobileMenu.tsx +209 -0
  257. package/src/components/Menu/MobileMenuGroup.tsx +73 -0
  258. package/src/components/Menu/index.ts +1 -0
  259. package/src/components/Navbar/BurgerButton.tsx +34 -0
  260. package/src/components/Navbar/MobileUserProfile.tsx +90 -0
  261. package/src/components/Navbar/Navbar.tsx +43 -14
  262. package/src/components/Navbar/NavbarDropdown.tsx +3 -2
  263. package/src/components/Navbar/NavbarMenu.tsx +8 -2
  264. package/src/components/NavbarLogo/NavbarLogo.tsx +11 -3
  265. package/src/components/OpenApiDocs/DevOnboardingTryItSecurity.tsx +2 -4
  266. package/src/components/PageNavigation/NextButton.tsx +3 -1
  267. package/src/components/PageNavigation/PageNavigation.tsx +10 -2
  268. package/src/components/PageNavigation/PreviousButton.tsx +3 -1
  269. package/src/components/Panel/PanelBody.ts +2 -1
  270. package/src/components/Panel/PanelHeader.ts +2 -1
  271. package/src/components/Panel/PanelHeaderTitle.ts +2 -1
  272. package/src/components/Profile/Profile.tsx +2 -2
  273. package/src/components/Profile/types.ts +1 -0
  274. package/src/components/SamplesPanelControls/SamplesPanelControls.ts +6 -3
  275. package/src/components/Search/CancelSearch.tsx +8 -2
  276. package/src/components/Search/ClearIcon.tsx +2 -1
  277. package/src/components/Search/ClockBackwardsIcon.tsx +1 -1
  278. package/src/components/Search/Input.tsx +2 -1
  279. package/src/components/Search/InputWrapper.tsx +3 -1
  280. package/src/components/Search/MobileSearchTrigger.tsx +16 -5
  281. package/src/components/Search/Popover.tsx +3 -2
  282. package/src/components/Search/RecentSearches.tsx +9 -3
  283. package/src/components/Search/Search.tsx +2 -2
  284. package/src/components/Search/SearchDialog.tsx +10 -3
  285. package/src/components/Search/SearchIcon.tsx +2 -1
  286. package/src/components/Search/SearchItem.tsx +4 -1
  287. package/src/components/Search/SearchTrigger.tsx +8 -2
  288. package/src/components/Search/Shortcut.tsx +3 -1
  289. package/src/components/Search/ShortcutKey.tsx +2 -1
  290. package/src/components/Search/SidebarSearch.tsx +2 -1
  291. package/src/components/Search/SuggestedPages.tsx +2 -2
  292. package/src/components/Separator/Separator.tsx +2 -2
  293. package/src/components/Separator/SeparatorItem.tsx +11 -4
  294. package/src/components/Separator/SeparatorLine.tsx +2 -1
  295. package/src/components/Sidebar/ApiCallItem.tsx +12 -4
  296. package/src/components/Sidebar/BackButton.tsx +3 -1
  297. package/src/components/Sidebar/Drilldown.tsx +3 -1
  298. package/src/components/Sidebar/DrilldownMenu.tsx +3 -2
  299. package/src/components/Sidebar/DrilldownMenuItem.tsx +2 -2
  300. package/src/components/Sidebar/HeaderWrapper.tsx +2 -1
  301. package/src/components/Sidebar/MobileSidebarButton.tsx +3 -2
  302. package/src/components/Sidebar/Sidebar.tsx +2 -1
  303. package/src/components/Sidebar/SidebarLayout.tsx +3 -4
  304. package/src/components/Sidebar/types.ts +3 -0
  305. package/src/components/SidebarActions/SidebarActions.tsx +3 -0
  306. package/src/components/SidebarLogo/SidebarLogo.tsx +3 -0
  307. package/src/components/TableOfContent/TableOfContent.tsx +3 -2
  308. package/src/components/Tags/Tags.tsx +2 -2
  309. package/src/components/Tiles/TileHeader.ts +2 -1
  310. package/src/components/Tiles/TileText.tsx +2 -1
  311. package/src/components/Typography/Emphasis.ts +2 -1
  312. package/src/components/Typography/H1.ts +2 -1
  313. package/src/components/Typography/H2.ts +2 -1
  314. package/src/components/Typography/H3.ts +2 -1
  315. package/src/components/Typography/SectionHeader.ts +2 -1
  316. package/src/components/Typography/Typography.ts +2 -1
  317. package/src/globalStyle.ts +66 -3
  318. package/src/hooks/useMobileMenu.ts +5 -1
  319. package/src/icons/BurgerIcon/BurgerIcon.tsx +12 -0
  320. package/src/icons/BurgerIcon/index.ts +1 -0
  321. package/src/icons/CloseIcon/CloseIcon.tsx +13 -0
  322. package/src/icons/CloseIcon/index.ts +1 -0
  323. package/src/icons/ColorModeIcon/ColorModeIcon.tsx +5 -1
  324. package/src/icons/ExpandIcon/ExpandIcon.tsx +46 -0
  325. package/src/icons/ExpandIcon/index.ts +1 -0
  326. package/src/icons/LogoutIcon/LogoutIcon.tsx +20 -0
  327. package/src/icons/LogoutIcon/index.ts +1 -0
  328. package/src/icons/index.ts +4 -0
  329. package/src/mocks/Sidebar/useSidebarItems.tsx +7 -0
  330. package/src/mocks/hooks/index.ts +16 -1
  331. package/src/mocks/media-css.ts +1 -0
  332. package/src/ui/Dropdown.tsx +1 -1
  333. package/src/ui/darkColors.tsx +11 -3
  334. package/lib/components/Navbar/MobileNavbarDropdown.d.ts +0 -8
  335. package/lib/components/Navbar/MobileNavbarDropdown.js +0 -30
  336. package/lib/components/Navbar/MobileNavbarItem.d.ts +0 -15
  337. package/lib/components/Navbar/MobileNavbarItem.js +0 -110
  338. package/lib/components/Navbar/MobileNavbarMenu.d.ts +0 -6
  339. package/lib/components/Navbar/MobileNavbarMenu.js +0 -92
  340. package/lib/components/Navbar/MobileNavbarMenuButton.d.ts +0 -4
  341. package/lib/components/Navbar/MobileNavbarMenuButton.js +0 -18
  342. package/src/components/Navbar/MobileNavbarDropdown.tsx +0 -37
  343. package/src/components/Navbar/MobileNavbarItem.tsx +0 -121
  344. package/src/components/Navbar/MobileNavbarMenu.tsx +0 -111
  345. package/src/components/Navbar/MobileNavbarMenuButton.tsx +0 -13
@@ -3,8 +3,15 @@ import styled from 'styled-components';
3
3
 
4
4
  import type { PropsWithChildren } from 'react';
5
5
 
6
- export function Sup({ children }: PropsWithChildren<unknown>): JSX.Element {
7
- return <Wrapper data-component-name="Markdown/Sup">{children}</Wrapper>;
6
+ export function Sup({
7
+ children,
8
+ className,
9
+ }: PropsWithChildren<{ className?: string }>): JSX.Element {
10
+ return (
11
+ <Wrapper data-component-name="Markdown/Sup" className={className}>
12
+ {children}
13
+ </Wrapper>
14
+ );
8
15
  }
9
16
 
10
17
  const Wrapper = styled.sup``;
@@ -8,18 +8,27 @@ import { MenuItemSwitch } from './MenuItemSwitch';
8
8
  export interface MenuListProps {
9
9
  items: ItemState[];
10
10
  depth?: number;
11
+ isMobile?: boolean;
12
+ className?: string;
11
13
  }
12
14
 
13
- export function Menu({ depth = 0, items }: MenuListProps) {
15
+ export function Menu({ depth = 0, items, className, isMobile }: MenuListProps) {
14
16
  // TODO: provide active section via MenuContext
15
17
  const activeItem = items.find(({ active }) => active);
16
18
 
17
19
  return (
18
- <ThemeMenu>
20
+ <ThemeMenu className={className}>
19
21
  {items.map((item, index) => {
20
22
  return (
21
- <MenuItemSwitch item={item} key={`${item.pageId}-${index}`} activeItem={activeItem}>
22
- {item.items?.length ? <Menu items={item.items} depth={depth + 1} /> : null}
23
+ <MenuItemSwitch
24
+ item={item}
25
+ key={`${item.pageId}-${index}`}
26
+ activeItem={activeItem}
27
+ isMobile={isMobile}
28
+ >
29
+ {item.items?.length ? (
30
+ <Menu items={item.items} depth={depth + 1} isMobile={isMobile} />
31
+ ) : null}
23
32
  </MenuItemSwitch>
24
33
  );
25
34
  })}
@@ -34,5 +43,7 @@ export const ThemeMenu = styled.ul.attrs(() => ({
34
43
  margin: 0;
35
44
  list-style: none;
36
45
  color: var(--sidebar-item-text-color);
37
- position: relative;
46
+ ${({ theme }) => theme.mediaQueries.medium} {
47
+ position: relative;
48
+ }
38
49
  `;
@@ -2,11 +2,13 @@ import styled from 'styled-components';
2
2
 
3
3
  interface MenuContainerProps {
4
4
  growContent?: boolean;
5
+ className?: string;
5
6
  }
6
7
 
7
- export const MenuContainer = styled.div.attrs<MenuContainerProps>(({ growContent }) => ({
8
+ export const MenuContainer = styled.div.attrs<MenuContainerProps>(({ growContent, className }) => ({
8
9
  'data-component-name': 'Menu/MenuContainer',
9
10
  growContent: growContent === undefined ? true : growContent,
11
+ className,
10
12
  }))<MenuContainerProps>`
11
13
  position: relative;
12
14
  overflow-y: auto;
@@ -12,6 +12,7 @@ interface MenuGroupProps {
12
12
  item: ItemState;
13
13
  isExpanded: boolean;
14
14
  toggleExpanded: () => void;
15
+ className?: string;
15
16
  }
16
17
 
17
18
  export function MenuGroup({
@@ -19,6 +20,7 @@ export function MenuGroup({
19
20
  isExpanded,
20
21
  toggleExpanded,
21
22
  children,
23
+ className,
22
24
  }: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
23
25
  const [showChildren, setShowChildren] = useState<boolean>(isExpanded);
24
26
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
@@ -39,7 +41,7 @@ export function MenuGroup({
39
41
  }, [isExpanded]);
40
42
 
41
43
  return (
42
- <Wrapper data-component-name="Menu/MenuGroup">
44
+ <Wrapper data-component-name="Menu/MenuGroup" className={className}>
43
45
  <MenuLinkItem item={item}>
44
46
  <MenuGroupLabel
45
47
  onClick={toggleExpanded}
@@ -47,10 +49,7 @@ export function MenuGroup({
47
49
  active={item.active}
48
50
  role={!item.link ? 'link' : 'none'}
49
51
  >
50
- <MenuGroupArrow
51
- visibility={item.items.length ? 'visible' : 'hidden'}
52
- direction={isExpanded ? 'down' : 'right'}
53
- />
52
+ {!!item.items.length && <MenuGroupArrow direction={isExpanded ? 'down' : 'right'} />}
54
53
  {translate(item.labelTranslationKey, item.label)}
55
54
  </MenuGroupLabel>
56
55
  </MenuLinkItem>
@@ -8,15 +8,15 @@ import { SeparatorLine } from '@theme/components/Separator/SeparatorLine';
8
8
  import type { MenuItemProps } from '@theme/components/Sidebar/types';
9
9
  import { useTranslate } from '@portal/hooks';
10
10
 
11
- export function MenuItem({ item }: MenuItemProps): JSX.Element {
11
+ export function MenuItem({ item, className }: MenuItemProps): JSX.Element {
12
12
  const { translate } = useTranslate();
13
13
  return (
14
- <Wrapper data-component-name="Sidebar/MenuItem">
14
+ <Wrapper data-component-name="Sidebar/MenuItem" className={className}>
15
15
  <MenuLinkItem item={item}>
16
- <MenuItemLabel active={item.active}>
16
+ <Label active={item.active}>
17
17
  {translate(item.labelTranslationKey, item.label)}
18
18
  {item.external ? <ExternalIcon dataComponentName="Sidebar/ExternalIcon" /> : null}
19
- </MenuItemLabel>
19
+ </Label>
20
20
  </MenuLinkItem>
21
21
 
22
22
  {item.separatorLine ? <SeparatorLine /> : null}
@@ -25,3 +25,21 @@ export function MenuItem({ item }: MenuItemProps): JSX.Element {
25
25
  }
26
26
 
27
27
  const Wrapper = styled.div``;
28
+
29
+ const Label = styled(MenuItemLabel)<{ active?: boolean }>`
30
+ color: var(--mobile-menu-item-text-color);
31
+
32
+ ${({ theme }) => theme.mediaQueries.medium} {
33
+ color: var(--sidebar-item-text-color);
34
+ }
35
+
36
+ ${({ active, theme }) =>
37
+ active &&
38
+ `
39
+ color: var(--mobile-menu-item-active-text-color);
40
+
41
+ ${theme.mediaQueries.medium} {
42
+ color: var(--sidebar-item-active-color);
43
+ }
44
+ `};
45
+ `;
@@ -1,7 +1,8 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- export const MenuItemLabel = styled.li.attrs(() => ({
3
+ export const MenuItemLabel = styled.li.attrs<{ className?: string }>(({ className }) => ({
4
4
  'data-component-name': 'Menu/MenuItemLabel',
5
+ className,
5
6
  }))<{ active?: boolean }>`
6
7
  display: flex;
7
8
  align-items: center;
@@ -22,17 +23,25 @@ export const MenuItemLabel = styled.li.attrs(() => ({
22
23
  );
23
24
  border-radius: var(--sidebar-item-border-radius);
24
25
 
25
- ${(props) =>
26
- props.active
27
- ? `
28
- color: var(--sidebar-item-active-color);
29
- background-color: var(--sidebar-item-active-background-color);
30
- `
31
- : null};
26
+ ${({ active, theme }) =>
27
+ active &&
28
+ `
29
+ color: var(--mobile-menu-item-active-text-color);
30
+ background-color: var(--mobile-menu-item-active-color);
31
+
32
+ ${theme.mediaQueries.medium} {
33
+ color: var(--sidebar-item-active-color);
34
+ background-color: var(--sidebar-item-active-background-color);
35
+ }
36
+ `};
32
37
 
33
38
  :hover {
34
- color: var(--sidebar-item-hover-color);
35
- background-color: var(--sidebar-item-hover-background-color);
39
+ color: var(--mobile-menu-item-active-text-color);
40
+
41
+ ${({ theme }) => theme.mediaQueries.medium} {
42
+ color: var(--sidebar-item-hover-color);
43
+ background-color: var(--sidebar-item-hover-background-color);
44
+ }
36
45
  }
37
46
 
38
47
  :empty {
@@ -8,6 +8,7 @@ import { MenuType } from '@portal/Sidebar/types';
8
8
  import { getMenuType } from '@portal/Sidebar/getMenuType';
9
9
  import { useDrilldown } from '@portal/Sidebar/useDrilldown';
10
10
  import { useMenuGroup } from '@portal/Sidebar/useMenuGroup';
11
+ import { MobileMenuGroup } from '@theme/components/Menu/MobileMenuGroup';
11
12
 
12
13
  export function MenuItemSwitch(props: PropsWithChildren<MenuItemProps>) {
13
14
  const type = getMenuType(props.item);
@@ -24,26 +25,27 @@ export function MenuItemSwitch(props: PropsWithChildren<MenuItemProps>) {
24
25
  });
25
26
 
26
27
  const { MenuGroup, handleGroupClick, isExpanded } = useMenuGroup(props.item);
27
-
28
28
  switch (type) {
29
29
  case MenuType.Separator:
30
30
  return <Separator {...props} />;
31
31
  case MenuType.Operation:
32
32
  return <ApiCallItem {...props} />;
33
33
  case MenuType.Group:
34
+ const Group = props.isMobile ? MobileMenuGroup : MenuGroup;
35
+
34
36
  if (!props.item.items?.length) {
35
37
  // Needed for OpenApi docs model items
36
38
  return (
37
- <MenuGroup item={props.item} isExpanded={false} toggleExpanded={() => {}}>
39
+ <Group item={props.item} isExpanded={false} toggleExpanded={() => {}}>
38
40
  {props.children}
39
- </MenuGroup>
41
+ </Group>
40
42
  );
41
43
  }
42
44
 
43
45
  return (
44
- <MenuGroup item={props.item} isExpanded={isExpanded} toggleExpanded={handleGroupClick}>
46
+ <Group item={props.item} isExpanded={isExpanded} toggleExpanded={handleGroupClick}>
45
47
  {props.children}
46
- </MenuGroup>
48
+ </Group>
47
49
  );
48
50
  case MenuType.DrillDown:
49
51
  return (
@@ -2,8 +2,9 @@ import styled from 'styled-components';
2
2
 
3
3
  import { Link } from '@portal/Link';
4
4
 
5
- export const MenuLink = styled(Link).attrs(() => ({
5
+ export const MenuLink = styled(Link).attrs<{ className?: string }>(({ className }) => ({
6
6
  'data-component-name': 'Sidebar/MenuLink',
7
+ className,
7
8
  }))`
8
9
  text-decoration: none;
9
10
  color: var(--sidebar-item-text-color);
@@ -7,9 +7,10 @@ import type { MenuItemProps } from '@theme/components/Sidebar/types';
7
7
  export function MenuLinkItem({
8
8
  item,
9
9
  children,
10
+ className,
10
11
  }: React.PropsWithChildren<MenuItemProps>): JSX.Element {
11
12
  return (
12
- <Wrapper data-component-name="Sidebar/MenuLinkItem">
13
+ <Wrapper data-component-name="Sidebar/MenuLinkItem" className={className}>
13
14
  {item.link ? (
14
15
  <MenuLink to={item.link} {...item}>
15
16
  {children}
@@ -0,0 +1,209 @@
1
+ import React, { useState } from 'react';
2
+ import { useLocation } from 'react-router-dom';
3
+ import styled from 'styled-components';
4
+
5
+ import { DropdownWrapper } from '@theme/components/Navbar/NavbarDropdown';
6
+ import { isPrimitive, isEmptyArray, withPathPrefix } from '@theme/utils';
7
+ import type { ResolvedNavItem } from '@theme/types/portal';
8
+ import { Menu, MenuItemLabel } from '@theme/components/Menu/index';
9
+ import type { ItemState } from '@portal/Sidebar/types';
10
+ import { MobileUserProfile } from '@theme/components/Navbar/MobileUserProfile';
11
+ import { getPathnameForLocale } from '@portal/utils';
12
+ import { useI18nConfig, useTranslate } from '@portal/hooks';
13
+ import { ExpandIcon } from '@theme/icons';
14
+
15
+ interface MobileMenuProps {
16
+ navItems: ResolvedNavItem[];
17
+ sidebarItems: ItemState[];
18
+ className?: string;
19
+ }
20
+
21
+ enum MenuLevel {
22
+ NAVBAR = 'NAVBAR',
23
+ SIDEBAR = 'SIDEBAR',
24
+ }
25
+
26
+ export function MobileMenu({
27
+ navItems,
28
+ sidebarItems,
29
+ className,
30
+ }: MobileMenuProps): JSX.Element | null {
31
+ const [menuLevel, setMenuLevel] = useState(
32
+ sidebarItems.length ? MenuLevel.SIDEBAR : MenuLevel.NAVBAR,
33
+ );
34
+ const { pathname, hash } = useLocation();
35
+ const pathHash = pathname + hash;
36
+ const { defaultLocale, currentLocale, locales } = useI18nConfig();
37
+ const { translate } = useTranslate();
38
+
39
+ if (isPrimitive(navItems) || isEmptyArray(navItems)) {
40
+ return null;
41
+ }
42
+
43
+ const isItemActive = (item: ResolvedNavItem): boolean => {
44
+ return (
45
+ pathHash ===
46
+ withPathPrefix(getPathnameForLocale(item.link || '/', defaultLocale, currentLocale, locales))
47
+ );
48
+ };
49
+
50
+ const mapNavbarItems = (items: ResolvedNavItem[]): ItemState[] => {
51
+ return items.map(
52
+ (navItem) =>
53
+ ({
54
+ ...navItem,
55
+ ...(navItem.items && { items: mapNavbarItems(navItem.items) }),
56
+ ...('link' in navItem && { link: navItem.link || '/' }),
57
+ active: 'link' in navItem && isItemActive(navItem),
58
+ hasActiveSubItem: !!navItem.items?.find(isItemActive),
59
+ } as ItemState),
60
+ );
61
+ };
62
+
63
+ let menuItems: ItemState[];
64
+ switch (menuLevel) {
65
+ case MenuLevel.SIDEBAR:
66
+ menuItems = sidebarItems;
67
+ break;
68
+ default:
69
+ menuItems = mapNavbarItems(navItems);
70
+ }
71
+
72
+ const isMenuButtonVisible = menuLevel === MenuLevel.SIDEBAR;
73
+ const isPreviousButtonVisible = menuLevel === MenuLevel.NAVBAR && !!sidebarItems.length;
74
+ const isButtonsSectionVisible = isMenuButtonVisible || isPreviousButtonVisible;
75
+
76
+ const translationKeys = {
77
+ mainMenu: 'theme.mobileMenu.mainMenu',
78
+ previous: 'theme.mobileMenu.previous',
79
+ };
80
+
81
+ return (
82
+ <MobileMenuWrapper data-component-name="Menu/MobileMenu" className={className}>
83
+ <ScrollableArea>
84
+ {isButtonsSectionVisible && (
85
+ <ButtonsSection alignRight={isPreviousButtonVisible}>
86
+ {isMenuButtonVisible && (
87
+ <ControlButton
88
+ data-component-name="Menu/ControlButton"
89
+ onClick={() => setMenuLevel(MenuLevel.NAVBAR)}
90
+ >
91
+ <ExpandIcon direction="left" />
92
+ <ControlButtonLabel paddingDirection="left">
93
+ {translate(translationKeys.mainMenu, 'Main Menu')}
94
+ </ControlButtonLabel>
95
+ </ControlButton>
96
+ )}
97
+ {isPreviousButtonVisible && (
98
+ <ControlButton
99
+ data-component-name="Menu/ControlButton"
100
+ onClick={() => setMenuLevel(MenuLevel.SIDEBAR)}
101
+ >
102
+ <ControlButtonLabel paddingDirection="right">
103
+ {translate(translationKeys.previous, 'Previous')}
104
+ </ControlButtonLabel>
105
+ <ExpandIcon direction="right" />
106
+ </ControlButton>
107
+ )}
108
+ </ButtonsSection>
109
+ )}
110
+ <MenuWrapper>
111
+ <Menu items={menuItems} isMobile />
112
+ </MenuWrapper>
113
+ </ScrollableArea>
114
+ <MobileUserProfile />
115
+ </MobileMenuWrapper>
116
+ );
117
+ }
118
+
119
+ const MobileMenuWrapper = styled.div`
120
+ height: 100%;
121
+ width: 100%;
122
+ position: fixed;
123
+ z-index: var(--z-index-raised);
124
+ left: 0;
125
+ top: var(--navbar-height);
126
+ overflow-x: hidden;
127
+ transition: 0.5s;
128
+ display: flex;
129
+ flex-direction: column;
130
+ background: var(--mobile-menu-background);
131
+
132
+ ${({ theme }) => theme.mediaQueries.medium} {
133
+ display: none;
134
+ }
135
+
136
+ ${DropdownWrapper} {
137
+ & > div {
138
+ text-align: center;
139
+ padding: 10px 0;
140
+ cursor: pointer;
141
+ a {
142
+ color: var(--navbar-text-color);
143
+ text-decoration: none;
144
+ }
145
+ :hover {
146
+ text-decoration: underline;
147
+ }
148
+ }
149
+ }
150
+ `;
151
+
152
+ const ButtonsSection = styled.div<{ alignRight: boolean }>`
153
+ align-items: center;
154
+ display: flex;
155
+ justify-content: space-between;
156
+ ${({ alignRight }) => alignRight && 'justify-content: flex-end'};
157
+ `;
158
+
159
+ const ScrollableArea = styled.div`
160
+ padding-top: var(--mobile-menu-padding-top);
161
+ flex: 1;
162
+ overflow-y: scroll;
163
+ margin-bottom: 140px;
164
+ `;
165
+
166
+ const MenuWrapper = styled.div`
167
+ margin: 0 var(--mobile-menu-horizontal-margin);
168
+ margin-top: var(--mobile-menu-items-margin-top);
169
+ line-height: 22px;
170
+ background: var(--mobile-menu-background);
171
+
172
+ ${MenuItemLabel} {
173
+ margin: 0;
174
+ border-radius: var(--mobile-menu-item-radius);
175
+ padding-left: var(--sidebar-item-padding-horizontal);
176
+ }
177
+ `;
178
+
179
+ export const ControlButton = styled.li`
180
+ display: inline-block;
181
+ padding: var(--mobile-menu-control-button-padding-vertical)
182
+ var(--mobile-menu-control-button-padding-horizontal);
183
+ margin: var(--mobile-menu-control-button-margin-vertical)
184
+ var(--mobile-menu-control-button-margin-horizontal);
185
+ text-align: center;
186
+ font-size: var(--mobile-menu-control-button-font-size);
187
+ line-height: 22px;
188
+ font-weight: var(--mobile-menu-control-button-weight);
189
+ color: var(--mobile-menu-control-button-color);
190
+ cursor: pointer;
191
+
192
+ svg {
193
+ fill: var(--mobile-menu-control-button-color);
194
+ }
195
+
196
+ &:hover {
197
+ color: var(--mobile-menu-control-button-hover-color);
198
+
199
+ svg {
200
+ fill: var(--mobile-menu-control-button-hover-color);
201
+ }
202
+ }
203
+ `;
204
+
205
+ const ControlButtonLabel = styled.span<{ paddingDirection: 'right' | 'left' }>`
206
+ vertical-align: middle;
207
+ ${({ paddingDirection }) => paddingDirection === 'left' && 'padding-left: 8px'};
208
+ ${({ paddingDirection }) => paddingDirection === 'right' && 'padding-right: 8px'};
209
+ `;
@@ -0,0 +1,73 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { MenuLinkItem } from '@theme/components/Menu/MenuLinkItem';
5
+ import { MenuItemLabel } from '@theme/components/Menu/MenuItemLabel';
6
+ import { SeparatorLine } from '@theme/components/Separator/SeparatorLine';
7
+ import type { ItemState } from '@theme/components/Sidebar/types';
8
+ import { useTranslate } from '@portal/hooks';
9
+ import { ExpandIcon } from '@theme/icons';
10
+
11
+ interface MenuGroupProps {
12
+ item: ItemState;
13
+ isExpanded: boolean;
14
+ toggleExpanded: () => void;
15
+ }
16
+
17
+ export function MobileMenuGroup({
18
+ item,
19
+ isExpanded,
20
+ toggleExpanded,
21
+ children,
22
+ }: React.PropsWithChildren<MenuGroupProps>): JSX.Element {
23
+ const { translate } = useTranslate();
24
+
25
+ return (
26
+ <Wrapper data-component-name="Menu/MobileMenuGroup">
27
+ <MenuLinkItem item={item}>
28
+ <MenuGroupLabel onClick={toggleExpanded} active={item.active} expanded={isExpanded}>
29
+ <LabelContainer>
30
+ <Label>{translate(item.labelTranslationKey, item.label)}</Label>
31
+ </LabelContainer>
32
+ {!!item.items.length && <ExpandIcon direction={isExpanded ? 'down' : 'right'} />}
33
+ </MenuGroupLabel>
34
+ </MenuLinkItem>
35
+ <MenuWrapper isExpanded={isExpanded}>{children}</MenuWrapper>
36
+ {item.separatorLine ? <SeparatorLine /> : null}
37
+ </Wrapper>
38
+ );
39
+ }
40
+
41
+ const LabelContainer = styled.div`
42
+ display: flex;
43
+ `;
44
+
45
+ const Label = styled.div``;
46
+
47
+ const Wrapper = styled.div``;
48
+
49
+ const MenuWrapper = styled.div<{ isExpanded?: boolean }>`
50
+ padding-left: var(--mobile-menu-item-nested-offset);
51
+ overflow: hidden;
52
+ ${(props) => !props.isExpanded && 'max-height: 0'}
53
+ `;
54
+
55
+ const MenuGroupLabel = styled(MenuItemLabel)<{ active?: boolean; expanded?: boolean }>`
56
+ color: var(--mobile-menu-item-text-color);
57
+ background: var(--mobile-menu-background);
58
+ display: flex;
59
+ justify-content: space-between;
60
+
61
+ ${({ active }) =>
62
+ active &&
63
+ `
64
+ color: var(--mobile-menu-item-active-text-color);
65
+ background-color: var(--mobile-menu-item-active-color);
66
+ `}
67
+
68
+ ${({ expanded }) =>
69
+ expanded &&
70
+ `
71
+ color: var(--mobile-menu-item-active-text-color);
72
+ `}
73
+ `;
@@ -5,3 +5,4 @@ export * from '@theme/components/Menu/MenuContainer';
5
5
  export * from '@theme/components/Menu/MenuItemLabel';
6
6
  export * from '@theme/components/Menu/MenuLink';
7
7
  export * from '@theme/components/Menu/MenuLinkItem';
8
+ export * from '@theme/components/Menu/MobileMenuGroup';
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { BurgerIcon, CloseIcon } from '@theme/icons';
5
+
6
+ export function BurgerButton({
7
+ isOpen,
8
+ onClick,
9
+ }: {
10
+ isOpen: boolean;
11
+ onClick: () => void;
12
+ }): JSX.Element | null {
13
+ return (
14
+ <Wrapper data-component-name="BurgerButton/BurgerButton" onClick={onClick}>
15
+ {isOpen ? <CloseIcon /> : <BurgerIcon />}
16
+ </Wrapper>
17
+ );
18
+ }
19
+
20
+ const Wrapper = styled.div`
21
+ display: flex;
22
+ align-items: center;
23
+ cursor: pointer;
24
+ user-select: none;
25
+ fill: var(--navbar-text-color);
26
+
27
+ * {
28
+ margin: var(--mobile-menu-burger-button-margin);
29
+ }
30
+
31
+ ${({ theme }) => theme.mediaQueries.medium} {
32
+ display: none;
33
+ }
34
+ `;
@@ -0,0 +1,90 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ import { useProfileProps } from '@portal/Profile/useProfileProps';
5
+ import { LogoutIcon } from '@theme/icons/LogoutIcon';
6
+ import { AvatarWrapper, ProfileWrapper, Profile } from '@theme/components/Profile/Profile';
7
+ import { useThemeConfig } from '@theme/hooks/useThemeConfig';
8
+ import { useTranslate } from '@portal/hooks';
9
+
10
+ export function MobileUserProfile(): JSX.Element {
11
+ const { userProfile } = useThemeConfig();
12
+ const { userData, handleLogout, loginUrl } = useProfileProps();
13
+ const { translate } = useTranslate();
14
+ const translationKeys = {
15
+ login: 'theme.profile.login',
16
+ };
17
+
18
+ if (!userData?.isAuthenticated) {
19
+ return (
20
+ <MobileProfileWrapper data-component-name="Navbar/MobileUserProfile">
21
+ <LoginButton href={loginUrl} data-cy="login-btn">
22
+ {translate(translationKeys.login, userProfile?.loginLabel || 'Login')}
23
+ </LoginButton>
24
+ </MobileProfileWrapper>
25
+ );
26
+ }
27
+
28
+ return (
29
+ <MobileProfileWrapper data-component-name="Navbar/MobileUserProfile">
30
+ <UserDataWrapper>
31
+ <ProfilePicture>
32
+ <Profile name={userData.name} imageUrl={userData.picture} />
33
+ </ProfilePicture>
34
+ <UserName>{userData.name}</UserName>
35
+ </UserDataWrapper>
36
+ <LogoutButton onClick={() => handleLogout()}>
37
+ <LogoutIcon />
38
+ </LogoutButton>
39
+ </MobileProfileWrapper>
40
+ );
41
+ }
42
+ const LoginButton = styled.a`
43
+ background: var(--mobile-menu-login-button-background);
44
+ border-radius: 6px;
45
+ width: 100%;
46
+ margin: 0;
47
+ padding: 5px 0;
48
+ color: var(--mobile-menu-login-button-color);
49
+ font-size: 14px;
50
+ text-align: center;
51
+ line-height: 22px;
52
+ cursor: pointer;
53
+ text-decoration: none;
54
+ `;
55
+
56
+ const MobileProfileWrapper = styled.div`
57
+ display: flex;
58
+ justify-content: space-between;
59
+ align-items: center;
60
+ width: 100%;
61
+ position: fixed;
62
+ bottom: 0;
63
+ padding: 18px 16px;
64
+ border-top: 1px solid var(--mobile-menu-profile-border-color);
65
+ background: var(--mobile-menu-profile-background);
66
+ `;
67
+
68
+ const UserDataWrapper = styled.div`
69
+ display: flex;
70
+ align-items: center;
71
+ `;
72
+
73
+ const ProfilePicture = styled.div`
74
+ margin-right: 16px;
75
+
76
+ ${AvatarWrapper} {
77
+ margin: 0;
78
+ }
79
+
80
+ ${ProfileWrapper} {
81
+ padding: 0;
82
+ }
83
+ `;
84
+
85
+ const UserName = styled.div``;
86
+
87
+ const LogoutButton = styled.div`
88
+ cursor: pointer;
89
+ user-select: none;
90
+ `;