Skip to content

Commit b754518

Browse files
Merge pull request #139 from linked-planet/dev
Enhance GoBackItem and NestingItem components with additional styling…
2 parents 90fcdc6 + 1b3621a commit b754518

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

library/src/components/sidenavigation/SideNavigation.tsx

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,25 @@ export function ButtonItem({
201201
)
202202
}
203203

204-
function GoBackItem({ children, ...props }: Omit<_ButtonItemProps, "icon">) {
204+
function GoBackItem({
205+
children,
206+
iconClassName,
207+
iconStyle,
208+
...props
209+
}: Omit<_ButtonItemProps, "icon"> & {
210+
iconClassName?: string
211+
iconStyle?: React.CSSProperties
212+
}) {
205213
return (
206214
<ButtonItem
207215
iconBefore={
208216
<ArrowLeftIcon
209217
strokeWidth={3}
210-
className="rounded-full p-1 bg-neutral-full size-5.5 text-text-inverse"
218+
className={twMerge(
219+
"rounded-full p-1 bg-neutral-full size-5.5 text-text-inverse",
220+
iconClassName,
221+
)}
222+
style={iconStyle}
211223
/>
212224
}
213225
{...props}
@@ -450,7 +462,11 @@ function NavigationHeader({
450462
type _NestingItemProps = {
451463
children: React.ReactNode
452464
className?: string
465+
buttonClassName?: string
466+
titleClassName?: string
453467
style?: React.CSSProperties
468+
buttonStyle?: React.CSSProperties
469+
titleStyle?: React.CSSProperties
454470
title: string // title is used to identify the item and as a key
455471
sideNavStoreIdent?: string
456472
id: string
@@ -460,7 +476,11 @@ type _NestingItemProps = {
460476
function NestingItem({
461477
children,
462478
className,
479+
buttonClassName,
480+
titleClassName,
463481
style,
482+
buttonStyle,
483+
titleStyle,
464484
sideNavStoreIdent = "default",
465485
title,
466486
onClick,
@@ -495,13 +515,18 @@ function NestingItem({
495515
window.setTimeout(() => setTransitioning(null), animTime * 1000)
496516
onClick?.()
497517
}}
518+
title={title}
498519
iconAfter={
499520
<ArrowRightIcon
500521
strokeWidth={3}
501522
className="rounded-full p-1 box-border bg-neutral-full size-5.5 text-text-inverse"
502523
/>
503524
}
504525
id={id}
526+
className={buttonClassName}
527+
style={buttonStyle}
528+
titleClassName={titleClassName}
529+
titleStyle={titleStyle}
505530
>
506531
{title}
507532
</ButtonItem>
@@ -510,6 +535,12 @@ function NestingItem({
510535

511536
type _NestableNavigationContentProps = {
512537
goBackLabel?: string
538+
goBackButtonClassName?: string
539+
goBackButtonStyle?: React.CSSProperties
540+
goBackButtonIconClassName?: string
541+
goBackButtonIconStyle?: React.CSSProperties
542+
goBackButtonTitleClassName?: string
543+
goBackButtonTitleStyle?: React.CSSProperties
513544
children: React.ReactNode
514545
className?: string
515546
style?: React.CSSProperties
@@ -545,6 +576,12 @@ const animTime = 1
545576

546577
function NestableNavigationContent({
547578
goBackLabel = "Go Back",
579+
goBackButtonClassName,
580+
goBackButtonStyle,
581+
goBackButtonIconClassName,
582+
goBackButtonIconStyle,
583+
goBackButtonTitleClassName,
584+
goBackButtonTitleStyle,
548585
children,
549586
sideNavStoreIdent = "default",
550587
className,
@@ -608,6 +645,12 @@ function NestableNavigationContent({
608645
}}
609646
>
610647
<GoBackItem
648+
className={goBackButtonClassName}
649+
style={goBackButtonStyle}
650+
iconClassName={goBackButtonIconClassName}
651+
iconStyle={goBackButtonIconStyle}
652+
titleClassName={goBackButtonTitleClassName}
653+
titleStyle={goBackButtonTitleStyle}
611654
onClick={() => {
612655
setIsBack(true)
613656
// this setTimeout is required else the animation will not work correctly
@@ -654,7 +697,7 @@ function NestableNavigationContent({
654697
ease: "easeInOut",
655698
//delay: animTime * 0.5,
656699
}}
657-
className="border-b-border-separator border-t-border-separator box-border flex size-full border-b-2 border-t-2 border-solid"
700+
className="border-border-separator box-border flex size-full border-b-2 border-t-2 border-solid border-x-0"
658701
onAnimationStart={() => {
659702
onAnimationStart?.()
660703
}}

twThemes/twThemeAK.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
/* Border */
225225
--color-border: var(--ds-border, var(--color-gray-300));
226226
--color-border-bold: var(--ds-border-bold, var(--color-gray-500));
227-
--color-border-separator: var(--ds-menu-separator-color, var(--color-border));
227+
--color-border-separator: var(--ds-menu-separator-color, var(--ds-border, var(--color-gray-300)));
228228

229229
/* Icon */
230230
--color-icon: var(--ds-icon, var(--color-gray-500));

0 commit comments

Comments
 (0)