Skip to content

Commit 60be389

Browse files
chore: Fix sticky search section (#5334)
* Fix: Make search section sticky to prevent collision with main content Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Fix: Implement holistic solution for sticky search section Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Add Home page button above Resources in sidebar navigation Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Add blue Home icon to match other sidebar icons Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Add blue icons for Lineage and Permissions to match other sidebar icons Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Revert Lineage icon to original design while keeping blue color Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Revert lineage icon to use original graphApp icon Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Update Home icon to have a house shape Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Format Layout.tsx with yarn format Co-Authored-By: Francisco Javier Arceo <arceofrancisco@gmail.com> * Delete ui/src/graphics/LineageIcon.tsx --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 01cd442 commit 60be389

File tree

4 files changed

+74
-22
lines changed

4 files changed

+74
-22
lines changed

ui/src/graphics/HomeIcon.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react";
2+
3+
export const HomeIcon = () => {
4+
return (
5+
<svg
6+
width="16"
7+
height="16"
8+
viewBox="0 0 16 16"
9+
xmlns="http://www.w3.org/2000/svg"
10+
fill="#006BB4"
11+
>
12+
<path d="M8.36 1.37l6.36 5.88-.71.71L13 7.02v6.99h-3v-5H6v5H3V7.02L1.99 7.96l-.71-.71 6.36-5.88a.5.5 0 0 1 .72 0z" />
13+
</svg>
14+
);
15+
};

ui/src/graphics/PermissionsIcon.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from "react";
2+
3+
export const PermissionsIcon = () => {
4+
return (
5+
<svg
6+
width="16"
7+
height="16"
8+
viewBox="0 0 16 16"
9+
xmlns="http://www.w3.org/2000/svg"
10+
fill="#006BB4"
11+
>
12+
<path d="M12.9 7.1H11V4.2c0-1.7-1.3-3-3-3s-3 1.3-3 3v2.9H3.1C2.5 7.1 2 7.6 2 8.2v5.7c0 .6.5 1.1 1.1 1.1h9.8c.6 0 1.1-.5 1.1-1.1V8.2c0-.6-.5-1.1-1.1-1.1zM6 4.2c0-.6.4-1 1-1s1 .4 1 1v2.9H6V4.2z" />
13+
</svg>
14+
);
15+
};

ui/src/pages/Layout.tsx

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
EuiErrorBoundary,
88
EuiHorizontalRule,
99
EuiSpacer,
10-
EuiPageHeader,
1110
EuiFlexGroup,
1211
EuiFlexItem,
1312
} from "@elastic/eui";
@@ -155,27 +154,47 @@ const Layout = () => {
155154

156155
<EuiPageBody>
157156
<EuiErrorBoundary>
158-
{data && (
159-
<EuiPageHeader
160-
paddingSize="l"
157+
<div
158+
style={{
159+
display: "flex",
160+
flexDirection: "column",
161+
height: "100vh",
162+
}}
163+
>
164+
{data && (
165+
<div
166+
style={{
167+
position: "sticky",
168+
top: 0,
169+
zIndex: 100,
170+
backgroundColor: "var(--euiPageBackgroundColor)",
171+
borderBottom: "1px solid #D3DAE6",
172+
boxShadow: "0px 1px 5px rgba(0, 0, 0, 0.05)",
173+
padding: "16px",
174+
width: "100%",
175+
}}
176+
>
177+
<EuiFlexGroup justifyContent="center">
178+
<EuiFlexItem
179+
grow={false}
180+
style={{ width: "600px", maxWidth: "90%" }}
181+
>
182+
<RegistrySearch ref={searchRef} categories={categories} />
183+
</EuiFlexItem>
184+
</EuiFlexGroup>
185+
</div>
186+
)}
187+
<div
161188
style={{
162-
position: "sticky",
163-
top: 0,
164-
zIndex: 100,
165-
borderBottom: "1px solid #D3DAE6",
189+
flexGrow: 1,
190+
overflow: "auto",
191+
padding: "16px",
192+
height: "calc(100vh - 70px)",
166193
}}
167194
>
168-
<EuiFlexGroup justifyContent="center">
169-
<EuiFlexItem
170-
grow={false}
171-
style={{ width: "600px", maxWidth: "90%" }}
172-
>
173-
<RegistrySearch ref={searchRef} categories={categories} />
174-
</EuiFlexItem>
175-
</EuiFlexGroup>
176-
</EuiPageHeader>
177-
)}
178-
<Outlet />
195+
<Outlet />
196+
</div>
197+
</div>
179198
</EuiErrorBoundary>
180199
</EuiPageBody>
181200
</EuiPage>

ui/src/pages/Sidebar.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import { FeatureViewIcon } from "../graphics/FeatureViewIcon";
1212
import { FeatureServiceIcon } from "../graphics/FeatureServiceIcon";
1313
import { DatasetIcon } from "../graphics/DatasetIcon";
1414
import { FeatureIcon } from "../graphics/FeatureIcon";
15+
import { HomeIcon } from "../graphics/HomeIcon";
16+
import { PermissionsIcon } from "../graphics/PermissionsIcon";
1517

1618
const SideNav = () => {
1719
const registryUrl = useContext(RegistryPathContext);
@@ -66,8 +68,9 @@ const SideNav = () => {
6668
{
6769
name: "Home",
6870
id: htmlIdGenerator("home")(),
69-
isSelected: useMatchSubpath(`${baseUrl}`),
70-
renderItem: () => <div />,
71+
icon: <EuiIcon type={HomeIcon} />,
72+
renderItem: (props) => <Link {...props} to={`${baseUrl}`} />,
73+
isSelected: useMatchSubpath(`${baseUrl}$`),
7174
},
7275
{
7376
name: "Resources",
@@ -131,7 +134,7 @@ const SideNav = () => {
131134
{
132135
name: "Permissions",
133136
id: htmlIdGenerator("permissions")(),
134-
icon: <EuiIcon type="lock" />,
137+
icon: <EuiIcon type={PermissionsIcon} />,
135138
renderItem: (props) => (
136139
<Link {...props} to={`${baseUrl}/permissions`} />
137140
),

0 commit comments

Comments
 (0)