Skip to content

Commit b8255d3

Browse files
authored
Update the layout to work better on smaller devices like phones. (#173)
1 parent 72cf50b commit b8255d3

22 files changed

+44
-45
lines changed

src/assets/css/AccountOverview.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
.AccountRow {
44
vertical-align: middle;
5-
6-
.ImageAttachment {
7-
max-width: 2rem;
8-
}
95
}
106
}
117

src/components/account/own-row.component.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ const AccountRowComponent = ({ account, deleteCallback }: AccountRowProps) => {
3434
const accountArray = [account]
3535
return <tr onMouseLeave={ () => dropDownActions.close() }>
3636
<td>
37-
<h2 className='text-lg'><Link to={ accountLink }>{ account.name }</Link></h2>
37+
<h2 className='md:text-lg'><Link to={ accountLink }>{ account.name }</Link></h2>
3838

39-
<div className='text-muted pl-1 text-sm'>
39+
<div className='text-muted md:pl-1 text-sm flex md:block flex-col'>
4040
<label className='font-bold mr-1'><Translation label='Account.type'/>:</label>
41-
<Translation label={ `AccountType.${ account.type }` }/>
41+
<Translation className='md:px-0 px-2' label={ `AccountType.${ account.type }` }/>
4242
</div>
43-
<div className='text-muted pl-1 text-sm'>
43+
<div className='text-muted md:pl-1 text-sm flex md:block flex-col'>
4444
<label className='font-bold mr-1'><Translation label='Account.lastActivity'/>:</label>
45-
<DateComponent date={ account.history.lastTransaction }/>
45+
<DateComponent className='md:px-0 px-2' date={ account.history.lastTransaction }/>
4646
</div>
47-
<div className='mt-1 pl-1 text-muted text-sm'>{ account.description }</div>
47+
<div className='hidden md:block mt-1 pl-1 text-muted text-sm'>{ account.description }</div>
4848
</td>
4949
<td className='hidden md:table-cell'>
5050
{ account.account.iban && `${ account.account.iban }` }

src/components/account/transaction-list.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const TransactionList: FC<TransactionListProps> = ({ account, range }) => {
5454
.reduce((a, t) => a + t.amount, 0)
5555

5656
return <div key={key} className='flex flex-col gap-0.5 pb-1'>
57-
<div className='flex gap-2 items-center border-b-[1px] py-0.5 mb-1 bg-blue-200/20 rounded-lg px-2'>
57+
<div className='flex gap-2 items-center border-b-[1px] py-0.5 mb-1 px-2 md:rounded-lg bg-blue-300/10 md:bg-blue-200/20'>
5858
<div className='font-bold text-lg[1.5em] text-muted'>
5959
{ date.getDate() }
6060
</div>

src/components/breadcrumb/breadcrumb.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const BreadCrumbs = ({ children }: PropsWithChildren) => {
66
const onMenuClick = () => window.dispatchEvent(new CustomEvent('hamburger-menu-click'));
77

88
return <ol className='relative flex flex-wrap gap-1 border-b-separator
9-
mx-[-0.5rem] md:mx-[-1.25rem]
9+
md:mx-[-1.25rem]
1010
max-h-[38px]
1111
border-b-[1px] py-2 px-2 bg-background'>
1212
<li className='block md:hidden cursor-pointer'

src/components/budget/budget-detail.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const BudgetDetailComponent = ({ range }: { range: DateRange }) => {
7373

7474
if (!budget) return <Loading />
7575
return <>
76-
<div className='flex flex-col'>
76+
<div className='flex flex-col pl-16 md:pl-0'>
7777
<div className='flex'>
7878
<Translation label='page.budget.group.budget.period'
7979
className='font-bold mr-2 min-w-[10em] after:content-[":"]'/>
@@ -102,7 +102,7 @@ const BudgetDetailComponent = ({ range }: { range: DateRange }) => {
102102
month={ range.month() }
103103
onChanges={ loadBudget }/>
104104

105-
<div className='flex justify-end'>
105+
<div className='flex justify-end pr-2 md:pr-0'>
106106
{ currentMonth.isSame(range.year(), range.month()) && <AddExpenseDialog onChange={ loadBudget } /> }
107107
</div>
108108
</>

src/components/category/category-row.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const CategoryRow = ({ category, deleteCallback = () => undefined }: CategoryRow
3636
href={ `${ category.id }/edit` }/>
3737
</td>
3838
<td>{ category.label }</td>
39-
<td>{ category.description }</td>
39+
<td className='hidden md:table-cell'>{ category.description }</td>
4040
<td><DateComponent date={ category.lastUsed }/></td>
4141
</tr>
4242
)

src/components/form/input/InputGroup.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, {ChangeEventHandler, FC, FocusEvent, FocusEventHandler, ReactNode, useContext, useEffect} from "react";
1+
import React, {ChangeEventHandler, FC, ReactNode, useContext, useEffect} from "react";
22
import Translation from "../../localization/translation.component";
33
import HelpTranslation from "../../localization/help.component";
44

@@ -26,7 +26,7 @@ export const InputGroup: FC<InputGroupProps> = ({ id, help, title, required = fa
2626
{ help ? <HelpTranslation label={ help } className='font-normal text-end pr-1'/> : '' }
2727
</label>
2828
) }
29-
<div className={`flex-1 ${ inputClassName }`}>{ children }</div>
29+
<div className={`px-1 md:px-0 md:flex-1 ${ inputClassName }`}>{ children }</div>
3030
</div>
3131
}
3232

src/components/format/date.component.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import useLocalStorage from "../../hooks/local-storage.hook";
22

3-
const _ = ({ date }: { date?: string }) => {
3+
const _ = ({ date, className = '' }: { date?: string, className?: string }) => {
44
const [language] = useLocalStorage('language', 'en');
55

66
if (date) {
77
const formatted = new Intl.DateTimeFormat(language as string).format(new Date(date))
88
return (
9-
<span className='FormattedDate'>{formatted}</span>
9+
<span className={`FormattedDate ${className}`}>{formatted}</span>
1010
)
1111
}
1212

src/components/layout/card.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const Card: FC<CardProps> = ({ title, actions, buttons, children, className = ''
3131
{actions && <div className='font-normal text-sm flex gap-0.5'>{ actions }</div>}
3232
</header>
3333
)}
34-
<article className='bg-white p-4 first:rounded-t-lg last:rounded-b-lg'>
34+
<article className='bg-white py-4 md:px-4 first:rounded-t-lg last:rounded-b-lg'>
3535
{ children }
3636
</article>
3737
{ buttons &&

src/components/transaction/transaction-dialog.component.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ const NewTransactionDialog: FC<NewTransactionDialogProps> = ({ variant, icon, ty
2525

2626
return <>
2727
<Button label={ `page.transactions.${type}.add` }
28-
variant={ variant }
29-
onClick={ () => control.open() }
30-
icon={ icon }/>
28+
variant={ variant }
29+
className='[&>.Translation]:hidden text-xl md:text-sm md:[&>.Translation]:block'
30+
onClick={ () => control.open() }
31+
icon={ icon }/>
3132
<Form onSubmit={ onSelect } entity='transaction'>
3233
<Dialog
3334
title='page.accounts.select'

0 commit comments

Comments
 (0)