Skip to content

Commit

Permalink
Design fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DaryaLari committed Dec 5, 2024
1 parent c02ab09 commit 6d0f41c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 19 deletions.
35 changes: 23 additions & 12 deletions src/ui/units/dash/containers/FixedHeader/FixedHeader.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@
}

.dash-fixed-header {
$class: &;

$fixed-header-background: var(
--dl-color-fixed-header-background,
var(--g-color-base-simple-hover-solid)
);

$dash-inline-padding: var(--g-spacing-6);
--dash-inline-padding: var(--g-spacing-6);

margin-bottom: 20px;

Expand All @@ -34,7 +36,7 @@
position: fixed;
top: 40px;

margin-inline: calc(-1 * $dash-inline-padding);
margin-inline: calc(-1 * var(--dash-inline-padding));
z-index: 10;
max-height: calc(100vh - 40px);

Expand All @@ -43,10 +45,10 @@
display: flex;
flex-direction: row;

.dash-fixed-header__scrollable-container {
padding-inline: $dash-inline-padding;
#{$class}__scrollable-container {
padding-inline: var(--dash-inline-padding);
}
.dash-fixed-header__controls-settings {
#{$class}__controls-settings {
left: 0;
}
}
Expand All @@ -56,6 +58,22 @@
}
}

&_hidden {
margin: 0;
height: 0;

#{$class}__controls-settings {
top: 0;
}
}

&__controls-settings {
width: 20px;
position: absolute;
left: calc(-1 * var(--dash-inline-padding));
top: var(--g-spacing-2);
}

&__content {
position: relative;
display: flex;
Expand All @@ -81,13 +99,6 @@
}
}

&__controls-settings {
width: 20px;
position: absolute;
left: calc(-1 * $dash-inline-padding);
top: 0;
}

&__container {
display: flex;
flex-direction: row;
Expand Down
12 changes: 5 additions & 7 deletions src/ui/units/dash/containers/FixedHeader/FixedHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,10 @@ export function FixedHeaderWrapper({
const topOffset = calculateOffset({isEmbedded, isPublic});
const {isFixed, leftOffset, width} = useFixedHeaderRef(rootRef, topOffset);
const style = isFixed && !editMode ? {left: leftOffset, top: topOffset, width} : {};

const isRenderEmpty =
controlsRef.current?.children.length === 0 /* ||
controlsRef.current?.getBoundingClientRect().height === 0 */ &&
containerRef.current?.children.length === 0; /* ||
containerRef.current?.getBoundingClientRect().height === 0 */
controlsRef.current?.getBoundingClientRect().height === 0 &&
containerRef.current?.getBoundingClientRect().height === 0;

React.useEffect(() => {
if (isRenderEmpty) {
Expand Down Expand Up @@ -214,11 +213,10 @@ export function FixedHeaderWrapper({

return (
<div
className={b()}
className={b({hidden: isRenderEmpty})}
ref={rootRef}
style={{
height: isFixed ? containerHeight : undefined,
margin: containerHeight === 0 ? 0 : undefined,
height: isFixed ? containerHeight : 'auto',
}}
>
<div
Expand Down

0 comments on commit 6d0f41c

Please sign in to comment.