From 686a6e5055022e858364d5d6b661e6edf634a646 Mon Sep 17 00:00:00 2001 From: Kevin Schiffer Date: Thu, 11 Jan 2024 16:15:14 +0900 Subject: [PATCH] console,account: Apply more fixes --- .../breadcrumbs/breadcrumb/breadcrumb.styl | 9 +- .../breadcrumbs/breadcrumb/index.js | 6 +- .../components/breadcrumbs/breadcrumbs.js | 5 +- .../components/breadcrumbs/breadcrumbs.styl | 4 +- pkg/webui/components/button/button.styl | 17 +- pkg/webui/components/button/index.js | 59 ++----- pkg/webui/components/dropdown/attached.js | 86 +++++++++ pkg/webui/components/dropdown/dropdown.styl | 96 ++++++++-- pkg/webui/components/dropdown/index.js | 165 ++++++++---------- pkg/webui/components/dropdown/story.js | 4 +- pkg/webui/components/header/header.styl | 5 + pkg/webui/components/header/index.js | 19 +- pkg/webui/components/logo/index.js | 9 +- pkg/webui/components/logo/logo.styl | 100 +---------- .../components/profile-dropdown/index.js | 7 +- .../profile-dropdown/profile-dropdown.styl | 11 +- .../sidebar/dedicated-entity/index.js | 12 +- .../components/sidebar/search-button/index.js | 18 +- .../sidebar/search-button/search-button.styl | 21 ++- .../components/sidebar/side-footer/index.js | 4 +- .../sidebar/side-footer/side-footer.styl | 19 +- .../components/sidebar/side-header/index.js | 34 ++-- .../sidebar/side-header/side-header.styl | 8 + .../sidebar/side-menu/item/collapsible.js | 15 +- .../sidebar/side-menu/item/item.styl | 51 +++--- .../components/sidebar/side-menu/item/link.js | 19 +- .../components/sidebar/switcher/index.js | 6 +- .../components/sidebar/switcher/switcher.styl | 24 ++- .../console/containers/devices-table/index.js | 2 +- pkg/webui/console/containers/header/index.js | 9 +- pkg/webui/console/containers/logo/index.js | 22 +-- .../console/containers/side-bar/index.js | 67 ++++--- .../navigation/app-list-side-navigation.js | 4 +- .../navigation/app-side-navigation.js | 6 +- .../navigation/gtw-side-navigation.js | 6 +- .../console/containers/side-bar/side-bar.styl | 44 +++-- pkg/webui/console/views/app/app.styl | 13 +- pkg/webui/console/views/app/index.js | 2 +- pkg/webui/console/views/overview/index.js | 81 +-------- .../lib/components/full-view-error/error.js | 73 ++++---- pkg/webui/locales/en.json | 1 - pkg/webui/locales/ja.json | 1 - 42 files changed, 580 insertions(+), 584 deletions(-) create mode 100644 pkg/webui/components/dropdown/attached.js diff --git a/pkg/webui/components/breadcrumbs/breadcrumb/breadcrumb.styl b/pkg/webui/components/breadcrumbs/breadcrumb/breadcrumb.styl index c4ce46675c..c9e81b013c 100644 --- a/pkg/webui/components/breadcrumbs/breadcrumb/breadcrumb.styl +++ b/pkg/webui/components/breadcrumbs/breadcrumb/breadcrumb.styl @@ -14,29 +14,30 @@ .container + display: flex + &:not(:last-child):after material-icon() + nudge('down', 1px) margin: 0 $cs.xxs content: 'keyboard_arrow_right' color: $tc-subtle-gray - .link one-liner() text-decoration: none color: $tc-subtle-gray - min-height: 18px + display: flex + align-items: center +focus-visible() text-decoration: underline color: $tc-deep-gray - .last one-liner() display: flex align-items: center color: $tc-deep-gray - min-height: 18px font-weight: $fw.bold +media-query($bp.s) &:last-child diff --git a/pkg/webui/components/breadcrumbs/breadcrumb/index.js b/pkg/webui/components/breadcrumbs/breadcrumb/index.js index a25a39d8ba..dfe3a7ca85 100644 --- a/pkg/webui/components/breadcrumbs/breadcrumb/index.js +++ b/pkg/webui/components/breadcrumbs/breadcrumb/index.js @@ -30,17 +30,17 @@ const Breadcrumb = ({ className, path, content, isLast }) => { if (!isLast) { Component = Link componentProps = { - className: classnames(className, style.container, style.link), + className: style.link, to: path, secondary: true, } } else { Component = 'span' - componentProps = { className: classnames(className, style.container, style.last) } + componentProps = { className: classnames(className, style.last) } } return ( - + {isRawText ? content : } diff --git a/pkg/webui/components/breadcrumbs/breadcrumbs.js b/pkg/webui/components/breadcrumbs/breadcrumbs.js index 7c8e6a37a3..b7a492c86f 100644 --- a/pkg/webui/components/breadcrumbs/breadcrumbs.js +++ b/pkg/webui/components/breadcrumbs/breadcrumbs.js @@ -15,7 +15,6 @@ import React from 'react' import ReactDom from 'react-dom' import classnames from 'classnames' -import { Container } from 'react-grid-system' import PropTypes from '@ttn-lw/lib/prop-types' @@ -52,9 +51,7 @@ const PortalledBreadcrumbs = ({ className, ...rest }) => { nodes.push( ReactDom.createPortal(
- - - +
, element, ), diff --git a/pkg/webui/components/breadcrumbs/breadcrumbs.styl b/pkg/webui/components/breadcrumbs/breadcrumbs.styl index 8c23a52e43..c1ab67f57a 100644 --- a/pkg/webui/components/breadcrumbs/breadcrumbs.styl +++ b/pkg/webui/components/breadcrumbs/breadcrumbs.styl @@ -14,10 +14,10 @@ .breadcrumbs color: $tc-subtle-gray - height: $breadcrumbs-bar-height display: flex align-items: center overflow: hidden + height: 1rem +media-query($bp.s) overflow: auto @@ -30,3 +30,5 @@ &-container box-sizing: border-box height: $breadcrumbs-bar-height + display: flex + align-items: center diff --git a/pkg/webui/components/button/button.styl b/pkg/webui/components/button/button.styl index cd755958fe..0f904770d0 100644 --- a/pkg/webui/components/button/button.styl +++ b/pkg/webui/components/button/button.styl @@ -22,7 +22,7 @@ &.primary, &.secondary, &.naked position: relative display: inline-flex - transition: 80ms all ease-in-out + transition: 80ms background ease-in-out, 80ms color ease-in-out, 80ms border-color ease-in-out, 80ms box-shadow ease-in-out border-radius: $br.m outline: 0 cursor: pointer @@ -35,23 +35,20 @@ white-space: nowrap box-sizing: border-box - .arrow-icon - transform: rotate(0deg) - transition: transform .2s ease-in-out - margin-right: - $cs.xs - - .arrow-icon-expanded - transform: rotate(180deg) - transition: transform .2s ease-in-out - .icon margin-left: - $cs.xxs &:only-child margin-right: - $cs.xxs + .expand-icon + color: $c.grey-500 + font-size: 1.285rem + margin-right: - $cs.xxs + &.only-icon gap: 0 + padding: 0 $cs.s &.primary color: white diff --git a/pkg/webui/components/button/index.js b/pkg/webui/components/button/index.js index abcafb59a9..9d853df025 100644 --- a/pkg/webui/components/button/index.js +++ b/pkg/webui/components/button/index.js @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import React, { useCallback, forwardRef, useMemo, useState, useRef } from 'react' +import React, { useCallback, forwardRef, useMemo, useRef } from 'react' import classnames from 'classnames' import { useIntl } from 'react-intl' @@ -51,7 +51,8 @@ const assembleClassnames = ({ className, error, }) => - classnames(style.button, className, { + classnames(style.button, { + [className]: !Boolean(dropdownItems), // If there are dropdown items, the button is wrapped in a div with the className. [style.danger]: danger, [style.warning]: warning, [style.primary]: primary, @@ -67,7 +68,7 @@ const assembleClassnames = ({ }) const buttonChildren = props => { - const { dropdownItems, icon, busy, message, expanded, noDropdownIcon, children } = props + const { dropdownItems, icon, busy, message, noDropdownIcon, children } = props const content = ( <> @@ -75,16 +76,7 @@ const buttonChildren = props => { {message && } {children} {dropdownItems && ( - <> - {!noDropdownIcon && ( - - )} - + <>{!noDropdownIcon && } )} ) @@ -103,6 +95,7 @@ const Button = forwardRef((props, ref) => { disabled, dropdownItems, dropdownClassName, + dropdownPosition, name, type, value, @@ -111,48 +104,26 @@ const Button = forwardRef((props, ref) => { onBlur, onClick, form, + className, ...rest } = props - const [expanded, setExpanded] = useState(false) const innerRef = useRef() const combinedRef = combineRefs([ref, innerRef]) const dataProps = useMemo(() => filterDataProps(rest), [rest]) - const handleClickOutside = useCallback( - e => { - if (innerRef.current && !innerRef.current.contains(e.target)) { - setExpanded(false) - } - }, - [innerRef], - ) - - const toggleDropdown = useCallback(() => { - setExpanded(oldExpanded => { - const newState = !oldExpanded - if (newState) document.addEventListener('mousedown', handleClickOutside) - else document.removeEventListener('mousedown', handleClickOutside) - return newState - }) - }, [handleClickOutside]) - const handleClick = useCallback( evt => { if (busy || disabled) { return } - if (dropdownItems) { - toggleDropdown() - return - } // Passing a value to the onClick handler is useful for components that // are rendered multiple times, e.g. in a list. The value can be used to // identify the component that was clicked. onClick(evt, value) }, - [busy, disabled, dropdownItems, onClick, toggleDropdown, value], + [busy, disabled, onClick, value], ) const intl = useIntl() @@ -169,7 +140,7 @@ const Button = forwardRef((props, ref) => { ) : ( - + {Boolean(iconElement) ? iconElement : null} - - ) - - const handleMouseEnter = useCallback(() => { - if (leaveDelayTimer) { - clearTimeout(leaveDelayTimer) - setLeaveDelayTimer(null) - } - setExpandedSubmenu(true) - }, [leaveDelayTimer]) - - const handleMouseLeave = useCallback(() => { - // Set a timer when mouse leaves, to only close after a delay. - // This prevents the menu from closing when the mouse moves over the submenu - // and also makes the UI more forgiving when the mouse accidentally leaves the menu. - setLeaveDelayTimer( - setTimeout(() => { - setExpandedSubmenu(false) - }, 250), - ) - }, []) - - useEffect( - () => () => { - if (leaveDelayTimer) { - clearTimeout(leaveDelayTimer) - } - }, - [leaveDelayTimer], + ) - const withSubmenu = ( - + {submenuItems} - - + + ) return ( -
  • - {Boolean(submenuItems) ? withSubmenu : ItemElement} +
  • + {submenu || ItemElement}
  • ) } @@ -216,5 +202,6 @@ DropdownHeaderItem.propTypes = { Dropdown.Item = DropdownItem Dropdown.HeaderItem = DropdownHeaderItem +Dropdown.Attached = AttachedDropdown export default Dropdown diff --git a/pkg/webui/components/dropdown/story.js b/pkg/webui/components/dropdown/story.js index f72aa821de..67f236fd87 100644 --- a/pkg/webui/components/dropdown/story.js +++ b/pkg/webui/components/dropdown/story.js @@ -14,8 +14,6 @@ import React from 'react' -import style from './dropdown.styl' - import Dropdown from '.' export default { @@ -25,7 +23,7 @@ export default { export const Default = () => (
    - + diff --git a/pkg/webui/components/header/header.styl b/pkg/webui/components/header/header.styl index 4f555e5b5b..ea29eeb183 100644 --- a/pkg/webui/components/header/header.styl +++ b/pkg/webui/components/header/header.styl @@ -13,6 +13,7 @@ // limitations under the License. .container + --dropdown-offset: $cs.s padding: 0 $cs.m background: $c['tts-primary-050'] z-index: $zi.nav @@ -21,6 +22,10 @@ justify-content: space-between align-items: center height: 4rem + +media-query($bp.xs) + padding: 0 $cs.xs .logo height: $cs.l + +media-query($bp.xs) + width: 3rem diff --git a/pkg/webui/components/header/index.js b/pkg/webui/components/header/index.js index 4e9bd79180..6fb396579b 100644 --- a/pkg/webui/components/header/index.js +++ b/pkg/webui/components/header/index.js @@ -17,7 +17,6 @@ import classnames from 'classnames' import Button from '@ttn-lw/components/button' import ProfileDropdown from '@ttn-lw/components/profile-dropdown' -import Link from '@ttn-lw/components/link' import PropTypes from '@ttn-lw/lib/prop-types' @@ -34,19 +33,23 @@ const Header = ({ onMenuClick, ...rest }) => ( - // Const isGuest = !Boolean(user) -
    -
    -
    +
    +
    - ) } diff --git a/pkg/webui/components/sidebar/search-button/search-button.styl b/pkg/webui/components/sidebar/search-button/search-button.styl index dbc26d2621..a85444aa24 100644 --- a/pkg/webui/components/sidebar/search-button/search-button.styl +++ b/pkg/webui/components/sidebar/search-button/search-button.styl @@ -19,23 +19,31 @@ position: relative display: flex justify-content: space-between + align-items: center padding: $cs.xxs $cs.xxs gap: $cs.xxs box-shadow: 0px 2px 7px 1px rgba(0, 0, 0, 0.06) background: white - border: 1px solid $c.grey-100 + border: 1px solid $c.grey-200 border-radius: $br.l transition: border-color 0.08s linear, box-shadow 0.08s linear, color 0.08s linear + &:hover border: 1px solid $c.grey-200 color: $c.grey-700 box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, 0.08) - &-minimized + &.is-minimized justify-content: center padding: $cs.xs $cs.xxs + & > div p + display: none + + .backslash + display: none + p line-height: 1.4 @@ -44,7 +52,8 @@ position: relative top: 1px - .backslash-container + .backslash + margin: 0 height: 1.65rem // 24px width: 1.65rem // 24px text-align: center @@ -54,3 +63,9 @@ display: flex justify-content: center align-items: center + padding-bottom: 1px + + .fly-out-list + --dropdown-offset: calc(.75rem - 2px) + top: - $cs.xs + color: $c.grey-900 diff --git a/pkg/webui/components/sidebar/side-footer/index.js b/pkg/webui/components/sidebar/side-footer/index.js index f9e3fad506..76be31873a 100644 --- a/pkg/webui/components/sidebar/side-footer/index.js +++ b/pkg/webui/components/sidebar/side-footer/index.js @@ -122,7 +122,7 @@ const SideFooter = () => { return (
    ) } diff --git a/pkg/webui/components/sidebar/side-header/side-header.styl b/pkg/webui/components/sidebar/side-header/side-header.styl index d3274238fe..08ac433d96 100644 --- a/pkg/webui/components/sidebar/side-header/side-header.styl +++ b/pkg/webui/components/sidebar/side-header/side-header.styl @@ -22,6 +22,12 @@ flex-direction: column gap: $cs.xs + .logo + display: none + + .mini-logo + display: flex + .minimize-button transition: none @@ -34,4 +40,6 @@ width: 9.57rem .mini-logo + display: none width: 2.8rem + padding: $cs.s 0 diff --git a/pkg/webui/components/sidebar/side-menu/item/collapsible.js b/pkg/webui/components/sidebar/side-menu/item/collapsible.js index 7d030d8c27..33d192e770 100644 --- a/pkg/webui/components/sidebar/side-menu/item/collapsible.js +++ b/pkg/webui/components/sidebar/side-menu/item/collapsible.js @@ -39,8 +39,8 @@ const CollapsibleItem = ({ currentPathName, }) => { const ref = useRef() - const subItems = children - .filter(item => Boolean(item) && 'props' in item) + const subItems = React.Children.toArray(children) + .filter(item => React.isValidElement(item) && item.props) .map(item => ({ title: item.props.title, path: item.props.path, @@ -50,11 +50,10 @@ const CollapsibleItem = ({ const subItemActive = subItems.some(item => currentPathName.includes(item.path)) return ( -
    +
    diff --git a/pkg/webui/components/sidebar/side-menu/item/item.styl b/pkg/webui/components/sidebar/side-menu/item/item.styl index 876f0aa2b3..01ca8f5eb6 100644 --- a/pkg/webui/components/sidebar/side-menu/item/item.styl +++ b/pkg/webui/components/sidebar/side-menu/item/item.styl @@ -12,6 +12,25 @@ // See the License for the specific language governing permissions and // limitations under the License. +.container + position: relative + + &.is-minimized, &.is-minimized .link + justify-content: center + + .title + display: none + + .expand-icon + display: none + + .icon + transition: color 50ms linear + color: $c.grey-500 + + .sub-item-list + display: none + .message vertical-align: middle @@ -58,37 +77,7 @@ .icon color: inherit -.is-minimized - justify-content: center - - .title - display: none - - .expand-icon - display: none - - .icon - transition: color 50ms linear - color: $c.grey-500 - -.sub-item-list - &.is-minimized - +media-query-min($bp.m) - display: none - .fly-out-list + --dropdown-offset: $cs.xs top: - $cs.xs - left: calc(4rem - 3px) - position: absolute - padding-left: 1rem z-index: $zi.dropdown - - // Pseudo element to extend the clickable area - // to connect with the parent button. - &:before - content: "" - position: absolute - top: 0 - left: -1rem - width: 1rem - height: 100% diff --git a/pkg/webui/components/sidebar/side-menu/item/link.js b/pkg/webui/components/sidebar/side-menu/item/link.js index b81b6256c5..4723dc8348 100644 --- a/pkg/webui/components/sidebar/side-menu/item/link.js +++ b/pkg/webui/components/sidebar/side-menu/item/link.js @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import React, { useCallback, useContext } from 'react' +import React, { useCallback, useContext, useRef } from 'react' import { NavLink } from 'react-router-dom' import classnames from 'classnames' @@ -28,28 +28,27 @@ import PropTypes from '@ttn-lw/lib/prop-types' import style from './item.styl' const MenuLink = ({ icon, title, path, onClick, exact, disabled }) => { + const ref = useRef() const { isMinimized } = useContext(SidebarContext) const className = useCallback( ({ isActive }) => - classnames(style.link, { + classnames(style.link, style.container, { [style.active]: isActive, [style.disabled]: disabled, - 'j-center': isMinimized, + [style.isMinimized]: isMinimized, }), [disabled, isMinimized], ) return ( - + {icon && }{' '} - {!isMinimized && } + {isMinimized && ( -
    - - - -
    + + + )}
    ) diff --git a/pkg/webui/components/sidebar/switcher/index.js b/pkg/webui/components/sidebar/switcher/index.js index 4248e5fbca..95c6ff6bf7 100644 --- a/pkg/webui/components/sidebar/switcher/index.js +++ b/pkg/webui/components/sidebar/switcher/index.js @@ -57,7 +57,7 @@ const Switcher = ({ isMinimized }) => { @@ -71,7 +71,7 @@ const Switcher = ({ isMinimized }) => { @@ -85,7 +85,7 @@ const Switcher = ({ isMinimized }) => { diff --git a/pkg/webui/components/sidebar/switcher/switcher.styl b/pkg/webui/components/sidebar/switcher/switcher.styl index d3039557da..6631298bb0 100644 --- a/pkg/webui/components/sidebar/switcher/switcher.styl +++ b/pkg/webui/components/sidebar/switcher/switcher.styl @@ -14,7 +14,7 @@ .switcher-container border-radius: $br.l - border: 1px solid $c.grey-100 + border: 1px solid $c.grey-200 background: white box-shadow: 0px 2px 7px 1px rgba(0, 0, 0, 0.06) display: flex @@ -29,7 +29,9 @@ display: flex justify-content: center width: 100% - transition: background 200ms ease-in-out + transition: background 80ms ease-in-out + position: relative + padding: $cs.s $cs.xxs &.active background: $c.grey-900 @@ -46,6 +48,24 @@ &:not(.active) background: $c.grey-100 + &.is-minimized + flex-direction: column + + .link + padding: $cs.xs 0 + + .caption + display: none + + &:not(.is-minimized) + .icon + display: none + .icon font-size: $fs.xl font-weight: 300 + + .fly-out-list + --dropdown-offset: calc(1rem - 2px) + top: - $cs.xs + color: $c.grey-900 diff --git a/pkg/webui/console/containers/devices-table/index.js b/pkg/webui/console/containers/devices-table/index.js index 90ecf5a39f..7f08442372 100644 --- a/pkg/webui/console/containers/devices-table/index.js +++ b/pkg/webui/console/containers/devices-table/index.js @@ -181,10 +181,10 @@ const DevicesTableInner = () => { const importButton = mayImportDevices && ( ) diff --git a/pkg/webui/console/containers/header/index.js b/pkg/webui/console/containers/header/index.js index 6ca6c5291e..52354d3311 100644 --- a/pkg/webui/console/containers/header/index.js +++ b/pkg/webui/console/containers/header/index.js @@ -20,6 +20,7 @@ import Dropdown from '@ttn-lw/components/dropdown' import sharedMessages from '@ttn-lw/lib/shared-messages' import { selectAssetsRootPath, selectBrandingRootPath } from '@ttn-lw/lib/selectors/env' +import PropTypes from '@ttn-lw/lib/prop-types' import selectAccountUrl from '@console/lib/selectors/app-config' import { @@ -37,7 +38,7 @@ import Logo from '../logo' const accountUrl = selectAccountUrl() -const Header = () => { +const Header = ({ onMenuClick }) => { const dispatch = useDispatch() const handleLogout = useCallback(() => dispatch(logout()), [dispatch]) @@ -122,9 +123,13 @@ const Header = () => { starDropdownItems={[]} brandLogo={brandLogo} Logo={Logo} - onMenuClick={() => null} + onMenuClick={onMenuClick} /> ) } +Header.propTypes = { + onMenuClick: PropTypes.func.isRequired, +} + export default Header diff --git a/pkg/webui/console/containers/logo/index.js b/pkg/webui/console/containers/logo/index.js index 00aed4c3a7..dd79fc2f80 100644 --- a/pkg/webui/console/containers/logo/index.js +++ b/pkg/webui/console/containers/logo/index.js @@ -16,24 +16,16 @@ import React from 'react' import LogoComponent from '@ttn-lw/components/logo' -import { - selectAssetsRootPath, - selectBrandingRootPath, - selectApplicationSiteName, -} from '@ttn-lw/lib/selectors/env' +import { selectAssetsRootPath, selectApplicationSiteName } from '@ttn-lw/lib/selectors/env' const logo = { - src: `${selectAssetsRootPath()}/logo.svg`, + src: `${selectAssetsRootPath()}/tts-logo.svg`, alt: `${selectApplicationSiteName()} Logo`, } -const hasCustomBranding = selectBrandingRootPath() !== selectAssetsRootPath() -const brandLogo = hasCustomBranding - ? { - src: `${selectBrandingRootPath()}/logo.svg`, - alt: 'Logo', - } - : undefined - -const Logo = props => +const miniLogo = { + src: `${selectAssetsRootPath()}/tts-logo-icon.svg`, + alt: `${selectApplicationSiteName()} Logo`, +} +const Logo = props => export default Logo diff --git a/pkg/webui/console/containers/side-bar/index.js b/pkg/webui/console/containers/side-bar/index.js index 429c5422d7..82ac94aa54 100644 --- a/pkg/webui/console/containers/side-bar/index.js +++ b/pkg/webui/console/containers/side-bar/index.js @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import React, { useCallback, useState } from 'react' +import React, { useCallback, useEffect, useState } from 'react' import { useLocation } from 'react-router-dom' import classnames from 'classnames' @@ -31,15 +31,28 @@ import SwitcherContainer from './switcher' import style from './side-bar.styl' -const getViewportWidth = () => - Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0) - -const Sidebar = ({ isDrawerOpen }) => { - const viewportWidth = getViewportWidth() - const isMobile = viewportWidth <= LAYOUT.BREAKPOINTS.M +const Sidebar = ({ isDrawerOpen, onDrawerCloseClick }) => { const { pathname } = useLocation() const [isMinimized, setIsMinimized] = useState(false) + // Reset minimized state when screen size changes to mobile. + useEffect(() => { + const handleResize = () => { + if (window.innerWidth < LAYOUT.BREAKPOINTS.M) { + setIsMinimized(false) + } + } + + window.addEventListener('resize', handleResize) + + return () => window.removeEventListener('resize', handleResize) + }, []) + + // Close the drawer on navigation changes. + useEffect(() => { + onDrawerCloseClick() + }, [pathname, onDrawerCloseClick]) + const onMinimizeToggle = useCallback(async () => { setIsMinimized(prev => !prev) }, []) @@ -58,36 +71,38 @@ const Sidebar = ({ isDrawerOpen }) => { 'd-flex direction-column j-between gap-cs-m bg-tts-primary-050', { [style.sidebarMinimized]: isMinimized, - [style.sidebarOpen]: isMobile && isDrawerOpen, + [style.sidebarOpen]: isDrawerOpen, 'p-cs-m': !isMinimized, - 'p-vert-cs-l': isMinimized, + 'p-vert-cs-s': isMinimized, 'p-sides-cs-xs': isMinimized, }, ) return ( -