Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add filter icon to help users find filters #10809

Merged
merged 6 commits into from
Oct 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/app/shared/services/view-preferences-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const DEFAULT_PREFERENCES: ViewPreferences = {
},
pageSizes: {},
hideBannerContent: '',
hideSidebar: true,
hideSidebar: false,
position: '',
theme: 'light'
};
Expand Down
8 changes: 7 additions & 1 deletion ui/src/app/sidebar/sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@
width: 35px;
}

i.fa-sign-in-alt {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.fa-sign-in-alt was an unused style

i.fa {
font-size: 22px;
margin-left: 3px;
margin-top: 12px;
}

&--active {
Expand Down Expand Up @@ -83,5 +85,9 @@
margin-right: 0;
margin-left: 10px;
}

.sidebar__nav-item i.fa {
margin-left: 13px;
}
}
}
33 changes: 21 additions & 12 deletions ui/src/app/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ export const Sidebar = (props: SidebarProps) => {
const [version, loading, error] = useData(() => services.version.version());
const locationPath = context.history.location.pathname;

const tooltipProps = {
placement: 'right',
popperOptions: {
modifiers: {
preventOverflow: {
boundariesElement: 'window'
}
}
}
};

return (
<div className={`sidebar ${props.pref.hideSidebar ? 'sidebar--collapsed' : ''}`}>
<div className='sidebar__logo'>
Expand All @@ -42,17 +53,7 @@ export const Sidebar = (props: SidebarProps) => {
{loading ? 'Loading...' : error?.state ? 'Unknown' : version?.Version || 'Unknown'}
</div>
{(props.navItems || []).map(item => (
<Tooltip
key={item.path}
content={item?.tooltip || item.title}
placement='right'
popperOptions={{
modifiers: {
preventOverflow: {
boundariesElement: 'window'
}
}
}}>
<Tooltip key={item.path} content={item?.tooltip || item.title} {...tooltipProps}>
<div
key={item.title}
className={`sidebar__nav-item ${locationPath === item.path || locationPath.startsWith(`${item.path}/`) ? 'sidebar__nav-item--active' : ''}`}
Expand All @@ -67,7 +68,15 @@ export const Sidebar = (props: SidebarProps) => {
</Tooltip>
))}
<div onClick={() => services.viewPreferences.updatePreferences({...props.pref, hideSidebar: !props.pref.hideSidebar})} className='sidebar__collapse-button'>
<i className={`fas fa-arrow-${props.pref.hideSidebar ? 'right' : 'left'}`} />
{props.pref.hideSidebar ? (
<Tooltip content='Expand Sidebar' {...tooltipProps}>
<div className='sidebar__nav-item'>
<i className={`fas fa-filter`} style={{fontSize: '14px', margin: '0 auto'}} />
</div>
</Tooltip>
) : (
<i className={`fas fa-arrow-left`} />
)}
</div>
<div id={SIDEBAR_TOOLS_ID} />
</div>
Expand Down