Skip to content

Commit

Permalink
added group to design system
Browse files Browse the repository at this point in the history
  • Loading branch information
hiderr committed Feb 21, 2025
1 parent c9f36a2 commit 2f76968
Show file tree
Hide file tree
Showing 4 changed files with 460 additions and 253 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,7 @@ tsconfig.tsbuildinfo
*storybook.log
storybook-static/

yaml-editor-test/
yaml-editor-test/

#cursor
.cursor
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.content {
overflow: hidden;
:global(.select-root) {
margin: 0.5rem 1rem;
}
}

.viewLink {
Expand Down
30 changes: 20 additions & 10 deletions apps/design-system/src/components/docs-navbar/docs-navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FC } from 'react'
import { Link, useLocation } from 'react-router-dom'
import { Link, useLocation, useNavigate } from 'react-router-dom'

import { viewPreviews } from '@/pages/view-preview/view-preview'
import { componentPages } from '@subjects/components/componentPages'

import { Icon, NavbarSkeleton, ScrollArea } from '@harnessio/ui/components'
import { Icon, NavbarSkeleton, ScrollArea, Select } from '@harnessio/ui/components'

import css from './docs-navbar.module.css'

Expand All @@ -14,6 +14,7 @@ export interface DocsNavbarProps {

const DocsNavbar: FC<DocsNavbarProps> = ({ className }) => {
const location = useLocation()
const navigate = useNavigate()

return (
<NavbarSkeleton.Root className={className}>
Expand All @@ -33,14 +34,23 @@ const DocsNavbar: FC<DocsNavbarProps> = ({ className }) => {
</Link>
))}
</NavbarSkeleton.Group>
<NavbarSkeleton.Group title="View previews" topBorder>
{Object.keys(viewPreviews).map(path => (
<Link key={path} to={`/view-preview/${path}`} target="_blank" className={css.viewLink}>
<NavbarSkeleton.Item text={path} />
<Icon name="supply-chain" size={12} />
</Link>
))}
</NavbarSkeleton.Group>

{Object.entries(viewPreviews).map(([groupKey, group]) => (
<NavbarSkeleton.Group key={groupKey} title={group.label} topBorder>
<Select.Root
placeholder={`Select ${group.label}`}
onValueChange={path => navigate(`/view-preview/${path}`)}
>
<Select.Content>
{Object.entries(group.items).map(([path, { label }]) => (
<Select.Item key={path} value={path}>
{label}
</Select.Item>
))}
</Select.Content>
</Select.Root>
</NavbarSkeleton.Group>
))}
</ScrollArea>
</NavbarSkeleton.Content>
<NavbarSkeleton.Footer>
Expand Down
Loading

0 comments on commit 2f76968

Please sign in to comment.