Skip to content

Commit

Permalink
🐛 - fix: fix a bug that caused the UI to horizontally overflow in cer…
Browse files Browse the repository at this point in the history
…tain cases
  • Loading branch information
svenvandescheur committed Oct 15, 2024
1 parent db50cbe commit 12b6c2f
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 43 deletions.
41 changes: 22 additions & 19 deletions src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
FloatingFocusManager,
FloatingPortal,
Side,
autoUpdate,
flip,
Expand Down Expand Up @@ -131,25 +132,27 @@ export const Dropdown: React.FC<DropdownProps> = ({
{label}
</Button>
{isOpen && (
<FloatingFocusManager context={context} modal={false}>
<div
className="mykn-dropdown__dropdown"
ref={refs.setFloating}
style={floatingStyles}
{...getFloatingProps()}
>
{isToolbarModuleLoaded(toolbarModuleState) && (
<toolbarModuleState.Toolbar
align="start"
direction="vertical"
items={items}
{...toolbarProps}
>
{children}
</toolbarModuleState.Toolbar>
)}
</div>
</FloatingFocusManager>
<FloatingPortal>
<FloatingFocusManager context={context} modal={false}>
<div
className="mykn-dropdown__dropdown"
ref={refs.setFloating}
style={floatingStyles}
{...getFloatingProps()}
>
{isToolbarModuleLoaded(toolbarModuleState) && (
<toolbarModuleState.Toolbar
align="start"
direction="vertical"
items={items}
{...toolbarProps}
>
{children}
</toolbarModuleState.Toolbar>
)}
</div>
</FloatingFocusManager>
</FloatingPortal>
)}
</div>
);
Expand Down
5 changes: 2 additions & 3 deletions src/components/layout/page/page.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
@use "../../../settings/constants";

.mykn-page {
align-items: start;
background-color: var(--page-color-background);
container-name: page;
display: flex;
flex-direction: column;
//flex-direction: column; // Removed to facilitate NavBar move in BaseTemplate.
box-sizing: border-box;
width: 100%;
min-height: 100%;
Expand Down Expand Up @@ -35,6 +34,6 @@
}

&--valign-middle {
justify-content: center;
align-items: center;
}
}
5 changes: 0 additions & 5 deletions src/components/navbar/navbar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
.mykn-navbar {
.mykn-logo {
width: 32px;
}
}
26 changes: 12 additions & 14 deletions src/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,17 @@ export type NavbarProps = ToolbarProps;
*/
export const Navbar: React.FC<NavbarProps> = ({ children, ...props }) => {
return (
<div className="mykn-navbar">
<Toolbar
align="center"
direction="vertical"
justify="v"
pad
padSize="xs"
variant="primary"
sticky="top"
{...props}
>
{children}
</Toolbar>
</div>
<Toolbar
align="center"
direction="vertical"
justify="v"
pad
padSize="xs"
variant="primary"
sticky="top"
{...props}
>
{children}
</Toolbar>
);
};
10 changes: 10 additions & 0 deletions src/components/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
}
}

&--direction-vertical .mykn-logo {
width: 32px;
}

&:not(#{&}--direction-responsive)#{&}--direction-horizontal {
max-height: 100%;
flex-direction: row;
Expand Down Expand Up @@ -74,6 +78,12 @@
flex-shrink: 9999;
}

@media screen and (max-width: constants.$breakpoint-desktop - 1px) {
&--direction-responsive .mykn-logo {
width: 32px;
}
}

@media screen and (min-width: constants.$breakpoint-desktop) {
&--align-start {
align-items: start;
Expand Down
4 changes: 2 additions & 2 deletions src/templates/base/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ export const BaseTemplate: React.FC<BaseTemplateProps> = ({
const content = (
<Grid>
<Column direction="row" span={12} {...columnProps}>
{slotPrimaryNavigation || contextNavigation}
{slotSidebar || contextSidebar}
{children}
</Column>
</Grid>
);

return (
<Page {...pageProps}>
{slotPrimaryNavigation || contextNavigation}
{slotSidebar || contextSidebar}
{container ? <Container>{content}</Container> : content}
</Page>
);
Expand Down

0 comments on commit 12b6c2f

Please sign in to comment.