Update UI layout and update request handler types

The UI layout has been updated to fix full screen display issues and enable class names in Sidebar. Separately, request handler function types have been improved in next route handlers for better flexibility and type safety.
This commit is contained in:
giancarlo
2024-05-20 12:11:28 +07:00
parent 951356bfa6
commit 912995730b
3 changed files with 21 additions and 13 deletions

View File

@@ -26,6 +26,7 @@ export type SidebarConfig = z.infer<typeof NavigationConfigSchema>;
export function Sidebar(props: {
collapsed?: boolean;
className?: string;
children:
| React.ReactNode
| ((props: {
@@ -35,7 +36,7 @@ export function Sidebar(props: {
}) {
const [collapsed, setCollapsed] = useState(props.collapsed ?? false);
const className = getClassNameBuilder()({
const className = getClassNameBuilder(props.className ?? '')({
collapsed,
});
@@ -191,9 +192,14 @@ export function SidebarItem({
);
}
function getClassNameBuilder() {
function getClassNameBuilder(className: string) {
return cva(
['flex box-content h-screen flex-col relative shadow-sm border-r'],
[
cn(
'flex box-content h-screen flex-col relative shadow-sm border-r',
className,
),
],
{
variants: {
collapsed: {