Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@internxt/ui",
"version": "0.1.15",
"version": "0.1.16",
"description": "Library of Internxt components",
"repository": {
"type": "git",
Expand Down Expand Up @@ -98,4 +98,4 @@
"prettier --write"
]
}
}
}
26 changes: 16 additions & 10 deletions src/components/navigation/sidenav/Sidenav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface SidenavProps {
showSubsections?: boolean;
isCollapsed?: boolean;
storage?: SidenavStorageProps;
notification?: ReactNode;
onToggleCollapse?: () => void;
}

Expand All @@ -55,6 +56,7 @@ export interface SidenavProps {
* @property {boolean} showSubsections - Determines whether to display the subsections of the sidenav
* @property {boolean} isCollapsed - Determines whether the sidenav is collapsed or not
* @property {SidenavStorage} storage - The storage information displayed at the bottom of the sidenav
* @property {ReactNode} notification - Optional notification node rendered above the storage section (hidden when collapsed)
* @property {() => void} onToggleCollapse - A callback function triggered when the collapse button is clicked
*/
const Sidenav = ({
Expand All @@ -66,6 +68,7 @@ const Sidenav = ({
showSubsections,
isCollapsed = false,
storage,
notification,
onToggleCollapse,
}: SidenavProps) => {
return (
Expand Down Expand Up @@ -94,18 +97,21 @@ const Sidenav = ({
</div>
</div>

{storage && (
{(notification || storage) && (
<div
className={`transition-all overflow-hidden duration-300 ${isCollapsed ? 'opacity-0 invisible delay-200' : 'opacity-100 delay-0'}`}
className={`flex flex-col transition-all overflow-hidden duration-300 ${isCollapsed ? 'opacity-0 invisible delay-200' : 'opacity-100 delay-0'}`}
>
<SidenavStorage
usage={storage.usage}
limit={storage.limit}
percentage={storage.percentage}
onUpgradeClick={storage.onUpgradeClick}
upgradeLabel={storage.upgradeLabel}
isLoading={storage.isLoading}
/>
{notification && <div className="px-2 pb-2">{notification}</div>}
{storage && (
<SidenavStorage
usage={storage.usage}
limit={storage.limit}
percentage={storage.percentage}
onUpgradeClick={storage.onUpgradeClick}
upgradeLabel={storage.upgradeLabel}
isLoading={storage.isLoading}
/>
)}
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ exports[`Sidenav Component > should match snapshot with storage 1`] = `
</div>
</div>
<div
class="transition-all overflow-hidden duration-300 opacity-100 delay-0"
class="flex flex-col transition-all overflow-hidden duration-300 opacity-100 delay-0"
>
<div
class="flex flex-col w-full gap-2.5 px-2 pb-5"
Expand Down
Loading