Skip to content

Commit

Permalink
Merge pull request #510 from omnifed/442-docs-update-side-navjson-to-…
Browse files Browse the repository at this point in the history
…be-side-navts

442 docs update side navjson to be side navts
  • Loading branch information
caseybaggz authored Sep 19, 2024
2 parents e0f3286 + 55b08cd commit e17f759
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 275 deletions.
6 changes: 3 additions & 3 deletions docs/app/components/CategoryList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import categoryData from '@/app/data/categories.json'
import navData from '@/app/react/side-nav.json'
import categoryData from '@/app/data/categories.react.json'
import { sideNavData } from '@/app/react/side-nav'
import { Image as ImageIcon } from '@cerberus-design/icons'
import { Show } from '@cerberus-design/react'
import { css } from '@cerberus/styled-system/css'
Expand All @@ -13,7 +13,7 @@ interface CategoryCardProps {
}

function CategoryCard(props: CategoryCardProps) {
const item = navData.find((navItem) => navItem.label === props.item)
const item = sideNavData.find((navItem) => navItem.label === props.item)
return (
<Show when={item != null}>
<Link
Expand Down
14 changes: 6 additions & 8 deletions docs/app/components/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ import { type PropsWithChildren, memo } from 'react'
import MatchSideNavItem from './MatchSideNavItem'

export type NavList = (HeadingItem | LinkItem)[]
type SideNavType = 'heading' | 'route'
export type NavItemType = 'heading' | 'route'

interface SideNavItem {
id: string
export interface HeadingItem {
label: string
type: SideNavType
}

export interface HeadingItem extends SideNavItem {
route?: never
tag?: never
type: 'heading'
}

export interface LinkItem extends SideNavItem {
export interface LinkItem {
label: string
route: string
tag: '' | 'new' | 'next'
type: 'route'
Expand Down
2 changes: 1 addition & 1 deletion docs/app/components/code-builder/builder-snippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default function BuilderSnippet(
if (isFormState(key) || isProgressKey(key)) {
return `{${selectedProps[key as keyof typeof selectedProps] || 'false'}}`
}
return `"${selectedProps[key as keyof typeof selectedProps] || 'false'}"`
return `"${selectedProps[key as keyof typeof selectedProps] || ''}"`
})
}, [props.code, selectedProps])

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,43 @@
"actions": {
"name": "Actions",
"description": "Components that trigger an action.",
"items": ["Button", "Icon Button"]
"items": ["Button", "Icon Button"],
"next": [],
"new": []
},
"communication": {
"name": "Communication",
"description": "Communication components provide useful information.",
"items": ["Avatar", "Notification", "Progress Bar", "Tag", "Tooltip"]
"items": ["Avatar", "Notification", "Progress Bar", "Tag", "Tooltip"],
"next": [],
"new": ["Avatar", "Progress Bar"]
},
"containment": {
"name": "Containment",
"description": "Components that contain other components.",
"items": ["Confirm Modal", "Prompt Modal", "Modal", "Table"]
"items": ["Confirm Modal", "Prompt Modal", "Modal", "Table"],
"next": [],
"new": []
},
"navigation": {
"name": "Navigation",
"description": "Components that help users navigate through the app.",
"items": ["Nav Menu", "Tabs"]
"items": ["Nav Menu", "Tabs"],
"next": [],
"new": []
},
"selection": {
"name": "Selection",
"description": "Components that allow users to select choices.",
"items": ["Drag & Drop", "Checkbox", "Radio", "Select", "Toggle"]
"items": ["Drag & Drop", "Checkbox", "Radio", "Select", "Toggle"],
"next": [],
"new": ["Select", "Checkbox"]
},
"inputs": {
"name": "Inputs",
"description": "Components that allow users to input data.",
"items": ["Input", "Textarea", "File Uploader"]
"items": ["Input", "Textarea", "File Uploader"],
"next": [],
"new": ["File Uploader"]
}
}
4 changes: 2 additions & 2 deletions docs/app/react/avatar/components/live-playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function AvatarPreview() {
return (
<Avatar
{...selectedProps}
ariaLabel={(selectedProps.ariaLabel as string) || 'User Avatar'}
ariaLabel={selectedProps.ariaLabel as string}
gradient="light-teal"
src={selectedProps.src as string}
/>
Expand All @@ -68,7 +68,7 @@ export function AvatarPreview() {
return (
<Avatar
{...selectedProps}
ariaLabel={(selectedProps.ariaLabel as string) || 'User Avatar'}
ariaLabel={selectedProps.ariaLabel as string}
src={selectedProps.src as string}
/>
)
Expand Down
8 changes: 4 additions & 4 deletions docs/app/react/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { PropsWithChildren } from 'react'
import { PageLayout, PageSideNav } from '../components/PageLayout'
import SideNav, { type NavList } from '../components/SideNav'
import sideNavData from './side-nav.json'
import type { Metadata } from 'next/types'
import { PageLayout, PageSideNav } from '../components/PageLayout'
import SideNav from '../components/SideNav'
import { sideNavData } from './side-nav'

interface ReactProps {}

Expand All @@ -14,7 +14,7 @@ export default function ReactLayout(props: PropsWithChildren<ReactProps>) {
return (
<PageLayout>
<PageSideNav>
<SideNav navList={sideNavData as NavList} />
<SideNav navList={sideNavData} />
</PageSideNav>

{props.children}
Expand Down
241 changes: 0 additions & 241 deletions docs/app/react/side-nav.json

This file was deleted.

Loading

0 comments on commit e17f759

Please sign in to comment.