File tree Expand file tree Collapse file tree 13 files changed +78
-36
lines changed
Expand file tree Collapse file tree 13 files changed +78
-36
lines changed Original file line number Diff line number Diff line change 77 useLocation ,
88} from 'react-router-dom' ;
99
10- import { BaseStyles , Box , ThemeProvider } from '@primer/react' ;
10+ import { BaseStyles , ThemeProvider } from '@primer/react' ;
1111
12- import { Sidebar } from './components/Sidebar ' ;
12+ import { AppLayout } from './components/layout/AppLayout ' ;
1313import { AppContext , AppProvider } from './context/App' ;
1414import { AccountsRoute } from './routes/Accounts' ;
1515import { FiltersRoute } from './routes/Filters' ;
@@ -38,8 +38,7 @@ export const App = () => {
3838 < BaseStyles >
3939 < AppProvider >
4040 < Router >
41- < Box className = "flex flex-col min-h-screen overflow-x-hidden overflow-y-auto pl-sidebar bg-gitify-background" >
42- < Sidebar />
41+ < AppLayout >
4342 < Routes >
4443 < Route
4544 path = "/"
@@ -83,7 +82,7 @@ export const App = () => {
8382 element = { < LoginWithOAuthAppRoute /> }
8483 />
8584 </ Routes >
86- </ Box >
85+ </ AppLayout >
8786 </ Router >
8887 </ AppProvider >
8988 </ BaseStyles >
Original file line number Diff line number Diff line change @@ -17,8 +17,9 @@ export const ReasonFilter: FC = () => {
1717 const { updateFilter, settings, notifications } = useContext ( AppContext ) ;
1818
1919 return (
20- < fieldset id = "filter-reasons" className = "mb-3" >
20+ < fieldset id = "filter-reasons" >
2121 < Title icon = { NoteIcon } > Reason</ Title >
22+
2223 < Stack direction = "vertical" gap = "condensed" >
2324 { Object . keys ( FORMATTED_REASONS ) . map ( ( reason : Reason ) => {
2425 const reasonDetails = getReasonDetails ( reason ) ;
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ export const StateFilter: FC = () => {
1919 const { updateFilter, settings, notifications } = useContext ( AppContext ) ;
2020
2121 return (
22- < fieldset id = "filter-state" className = "mb-3" >
23- < Stack direction = "horizontal" gap = "condensed" align = "baseline" >
22+ < fieldset id = "filter-state" >
23+ < Stack direction = "horizontal" gap = "condensed" >
2424 < Title icon = { IssueOpenedIcon } > State</ Title >
2525 < Tooltip
2626 name = "tooltip-filter-state"
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ export const SubjectTypeFilter: FC = () => {
1919 const { updateFilter, settings, notifications } = useContext ( AppContext ) ;
2020
2121 return (
22- < fieldset id = "filter-subject-type" className = "mb-3" >
22+ < fieldset id = "filter-subject-type" >
2323 < Stack direction = "horizontal" gap = "condensed" align = "baseline" >
2424 < Title icon = { BellIcon } > Type</ Title >
2525 < Tooltip
Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ export const UserHandleFilter: FC = () => {
119119 } ;
120120
121121 return (
122- < fieldset id = "filter-user-handles" className = "mb-3" >
122+ < fieldset id = "filter-user-handles" >
123123 < Stack direction = "horizontal" gap = "condensed" align = "baseline" >
124124 < Title icon = { MentionIcon } > Handles</ Title >
125125 < Tooltip
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export const UserTypeFilter: FC = () => {
2525 const { updateFilter, settings, notifications } = useContext ( AppContext ) ;
2626
2727 return (
28- < fieldset id = "filter-user-types" className = "mb-3" >
28+ < fieldset id = "filter-user-types" >
2929 < Stack direction = "horizontal" gap = "condensed" align = "baseline" >
3030 < Title icon = { FeedPersonIcon } > User Type</ Title >
3131 < Tooltip
Original file line number Diff line number Diff line change 1+ import { Box } from '@primer/react' ;
2+ import type { FC , ReactNode } from 'react' ;
3+
4+ import { Sidebar } from '../Sidebar' ;
5+
6+ interface AppLayoutProps {
7+ children : ReactNode ;
8+ }
9+
10+ /**
11+ * AppLayout is the main container for the application.
12+ * It handles the basic layout with sidebar and content area.
13+ */
14+ export const AppLayout : FC < AppLayoutProps > = ( { children } ) => {
15+ return (
16+ < Box className = "flex flex-col max-h-screen bg-gitify-background" >
17+ < Sidebar />
18+ { /* Content area with left padding to make space for the sidebar */ }
19+ < Box className = "flex-1 pl-sidebar" > { children } </ Box >
20+ </ Box >
21+ ) ;
22+ } ;
Original file line number Diff line number Diff line change 11import { Box } from '@primer/react' ;
22import type { FC , ReactNode } from 'react' ;
3+ import { cn } from '../../utils/cn' ;
34
45interface IContents {
56 children : ReactNode ;
7+ padding ?: boolean ;
68}
79
8- export const Contents : FC < IContents > = ( props : IContents ) => {
10+ /**
11+ * Contents component holds the main content of a page.
12+ * It provides proper padding and handles scrolling.
13+ */
14+ export const Contents : FC < IContents > = ( { children, padding = true } ) => {
915 return (
10- < Box className = " grow overflow-x -auto px-8 pb-2 mb-12 " >
11- { props . children }
16+ < Box className = { cn ( ' grow overflow-y -auto mb-4' , padding && 'px-8' ) } >
17+ { children }
1218 </ Box >
1319 ) ;
1420} ;
Original file line number Diff line number Diff line change 11import { Box } from '@primer/react' ;
22import type { FC , ReactNode } from 'react' ;
33
4- interface IPage {
4+ interface PageProps {
55 children : ReactNode ;
66 id : string ;
77}
88
9- export const Page : FC < IPage > = ( props : IPage ) => {
9+ /**
10+ * Page component represents a single page view.
11+ * It creates a column layout for header, content, and footer.
12+ * The height is 100% to fill the parent container.
13+ */
14+ export const Page : FC < PageProps > = ( { children, id } ) => {
1015 return (
11- < Box className = "flex flex-col h-screen" data-testid = { props . id } >
12- { props . children }
16+ < Box className = "flex flex-col h-screen" data-testid = { id } >
17+ { children }
1318 </ Box >
1419 ) ;
1520} ;
Original file line number Diff line number Diff line change 11import { Box , Stack } from '@primer/react' ;
22import type { FC , ReactNode } from 'react' ;
33
4- interface IFooter {
4+ interface FooterProps {
55 children : ReactNode ;
6- justify : 'end' | 'space-between' ;
6+ justify : 'end' | 'space-between' | 'start' | 'center' ;
77}
88
9- export const Footer : FC < IFooter > = ( props : IFooter ) => {
9+ /**
10+ * Footer component displays actions at the bottom of the page.
11+ * It is fixed to the viewport bottom.
12+ */
13+ export const Footer : FC < FooterProps > = ( { children, justify } ) => {
1014 return (
11- < Box className = "fixed bottom-0 left-sidebar right-0 bg-gitify-footer" >
12- < Stack direction = "horizontal" justify = { props . justify } padding = "condensed" >
13- { props . children }
15+ < Box className = "left-sidebar bg-gitify-footer" >
16+ < Stack direction = "horizontal" justify = { justify } padding = "condensed" >
17+ { children }
1418 </ Stack >
1519 </ Box >
1620 ) ;
You can’t perform that action at this time.
0 commit comments