(props: SideNavPanelAppProps)
| 135 | * route so links in the SideNav don't perform a real navigation. |
| 136 | */ |
| 137 | export function SideNavPanelApp(props: SideNavPanelAppProps): ReactNode { |
| 138 | let {children, defaultSelectedRoute, isCollapsed, onCollapsedChange} = props; |
| 139 | let [selectedRoute, setSelectedRoute] = useState(defaultSelectedRoute); |
| 140 | |
| 141 | return ( |
| 142 | <RouterProvider navigate={setSelectedRoute}> |
| 143 | <div |
| 144 | className={style({ |
| 145 | width: 'full', |
| 146 | maxWidth: 560, |
| 147 | height: 400, |
| 148 | display: 'grid', |
| 149 | gridTemplateAreas: ['header header', 'sidebar main'], |
| 150 | gridTemplateColumns: ['auto', '1fr'], |
| 151 | gridTemplateRows: ['auto', '1fr'], |
| 152 | backgroundColor: 'layer-1', |
| 153 | borderRadius: 'lg', |
| 154 | borderWidth: 1, |
| 155 | borderStyle: 'solid', |
| 156 | borderColor: 'gray-200', |
| 157 | overflow: 'hidden' |
| 158 | })}> |
| 159 | <div |
| 160 | className={style({ |
| 161 | gridArea: 'header', |
| 162 | display: 'flex', |
| 163 | alignItems: 'center', |
| 164 | gap: 12, |
| 165 | paddingX: 16, |
| 166 | paddingY: 12 |
| 167 | })}> |
| 168 | <div className={style({font: 'title-sm'})}>Acme Cloud</div> |
| 169 | <div className={style({flexGrow: 1, display: 'flex', justifyContent: 'center'})}> |
| 170 | <SearchField aria-label="Search" size="S" styles={style({maxWidth: 200})} /> |
| 171 | </div> |
| 172 | {onCollapsedChange ? ( |
| 173 | <ProfileMenu isCollapsed={!!isCollapsed} onCollapsedChange={onCollapsedChange} /> |
| 174 | ) : ( |
| 175 | <Avatar alt="Your account" src="https://i.imgur.com/xIe7Wlb.png" size={24} /> |
| 176 | )} |
| 177 | </div> |
| 178 | {children({selectedRoute})} |
| 179 | <div |
| 180 | className={style({ |
| 181 | gridArea: 'main', |
| 182 | backgroundColor: 'layer-2', |
| 183 | borderTopStartRadius: 'lg', |
| 184 | padding: 16, |
| 185 | font: 'ui', |
| 186 | color: 'neutral-subdued' |
| 187 | })}> |
| 188 | {selectedRoute} |
| 189 | </div> |
| 190 | </div> |
| 191 | </RouterProvider> |
| 192 | ); |
| 193 | } |
nothing calls this directly
no test coverage detected