File tree Expand file tree Collapse file tree 4 files changed +44
-3
lines changed Expand file tree Collapse file tree 4 files changed +44
-3
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ export function SideBarDrive({
7373 < TitleButton
7474 resource = { drive }
7575 clean
76+ current = { drive === currentSubject }
7677 title = { `Your current baseURL is ${ drive } ` }
7778 data-test = 'sidebar-drive-open'
7879 onClick = { ( ) => {
@@ -161,9 +162,24 @@ const DriveTitle = styled.h2`
161162 flex: 1;
162163` ;
163164
164- const TitleButton = styled ( Button ) `
165+ const TitleButton = styled ( Button ) < { current ?: boolean } > `
165166 text-align: left;
166167 flex: 1;
168+ padding: 0.5rem 1rem;
169+ border-radius: ${ props => props . theme . radius } ;
170+
171+ ${ ( { current, theme } ) =>
172+ current &&
173+ `
174+ color: ${ theme . colors . main } ;
175+ ` }
176+
177+ &:hover {
178+ background-color: ${ props => props . theme . colors . bg1 } ;
179+ }
180+ &:active {
181+ background-color: ${ props => props . theme . colors . bg2 } ;
182+ }
167183` ;
168184
169185const SideBarErr = styled ( ErrorLook ) `
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { styled } from 'styled-components';
22
33export interface SideBarItemProps {
44 disabled ?: boolean ;
5+ current ?: boolean ;
56}
67
78/** SideBarItem should probably be wrapped in an AtomicLink for optimal behavior */
@@ -20,12 +21,18 @@ export const SideBarItem = styled('span')<SideBarItemProps>`
2021 &:hover,
2122 &:focus {
2223 background-color: ${ p => p . theme . colors . bg1 } ;
23- color: ${ p => ( p . disabled ? p . theme . colors . main : p . theme . colors . text ) } ;
24+ // color: ${ p => ( p . disabled ? p . theme . colors . main : p . theme . colors . text ) } ;
2425 }
2526 &:active {
2627 background-color: ${ p => p . theme . colors . bg2 } ;
2728 }
2829
30+ ${ props =>
31+ props . current &&
32+ `
33+ color: ${ props . theme . colors . main } ;
34+ ` }
35+
2936 svg {
3037 font-size: 0.8rem;
3138 }
Original file line number Diff line number Diff line change 11import { styled } from 'styled-components' ;
22import { AtomicLink , AtomicLinkProps } from '../AtomicLink' ;
33import { SideBarItem } from './SideBarItem' ;
4+ import { useLocation } from '@tanstack/react-router' ;
45
56export interface SideBarMenuItemProps extends AtomicLinkProps {
67 label : string ;
@@ -20,9 +21,18 @@ export function SideBarMenuItem({
2021 subject,
2122 onClick,
2223} : SideBarMenuItemProps ) {
24+ const { pathname } = useLocation ( ) ;
25+ const targetPath = path || href || subject ;
26+ const current : boolean = pathname === targetPath ;
27+
2328 return (
2429 < AtomicLink href = { href } subject = { subject } path = { path } clean >
25- < SideBarItem key = { label } title = { helper } onClick = { onClick } >
30+ < SideBarItem
31+ key = { label }
32+ title = { helper }
33+ onClick = { onClick }
34+ current = { current }
35+ >
2636 { icon && < SideBarIcon > { icon } </ SideBarIcon > }
2737 { label }
2838 </ SideBarItem >
Original file line number Diff line number Diff line change 1+ /**
2+ * Formats a number as a currency string
3+ * @param value - The number to format
4+ * @param currency - The currency code (default: 'USD')
5+ * @param locale - The locale to use for formatting (default: 'en-US')
6+ * @returns A formatted currency string
7+ */
8+ export
You can’t perform that action at this time.
0 commit comments