Skip to content

Commit 8a6c54c

Browse files
authored
🎨 improving category spending side-nav style (#1548)
1 parent 85f2155 commit 8a6c54c

File tree

3 files changed

+34
-51
lines changed

3 files changed

+34
-51
lines changed

‎packages/desktop-client/src/components/reports/CategorySelector.tsx‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,29 @@ export default function CategorySelector({
2626
return (
2727
<>
2828
<div>
29-
<Button
30-
type="bare"
31-
style={{ padding: 4 }}
32-
onClick={e => setUncheckedHidden(!uncheckedHidden)}
33-
>
29+
<Button onClick={() => setUncheckedHidden(state => !state)}>
3430
{uncheckedHidden ? (
3531
<>
3632
<Eye width={20} height={20} />
37-
{'Checked'}
33+
Show unchecked
3834
</>
3935
) : (
4036
<>
4137
<EyeSlashed width={20} height={20} />
42-
{'All'}
38+
Hide unchecked
4339
</>
4440
)}
4541
</Button>
4642
</div>
43+
4744
<ul
4845
style={{
4946
listStyle: 'none',
5047
marginLeft: 0,
5148
paddingLeft: 0,
5249
paddingRight: 10,
50+
height: 320,
51+
overflowY: 'scroll',
5352
}}
5453
>
5554
{categoryGroups &&
@@ -72,7 +71,7 @@ export default function CategorySelector({
7271
style={{
7372
display:
7473
noCategorySelected && uncheckedHidden ? 'none' : 'flex',
75-
marginBottom: 4,
74+
marginBottom: 8,
7675
flexDirection: 'row',
7776
}}
7877
>
@@ -128,7 +127,7 @@ export default function CategorySelector({
128127
display:
129128
!isChecked && uncheckedHidden ? 'none' : 'flex',
130129
flexDirection: 'row',
131-
marginBottom: 2,
130+
marginBottom: 4,
132131
}}
133132
>
134133
<Checkbox

‎packages/desktop-client/src/components/reports/CategorySpending.js‎

Lines changed: 20 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ import { send } from 'loot-core/src/platform/client/fetch';
66
import * as monthUtils from 'loot-core/src/shared/months';
77

88
import useCategories from '../../hooks/useCategories';
9-
import Filter from '../../icons/v2/Filter2';
109
import { styles } from '../../style';
11-
import Button from '../common/Button';
1210
import Select from '../common/Select';
1311
import View from '../common/View';
1412

@@ -23,7 +21,6 @@ function CategoryAverage() {
2321
const categories = useCategories();
2422

2523
const [selectedCategories, setSelectedCategories] = useState(null);
26-
const [categorySelectorVisible, setCategorySelectorVisible] = useState(false);
2724

2825
const [allMonths, setAllMonths] = useState(null);
2926

@@ -106,38 +103,25 @@ function CategoryAverage() {
106103
const numberOfMonthsLine = numberOfMonthsOptions.length - 1;
107104

108105
const headerPrefixItems = (
109-
<>
110-
<Button
111-
type="bare"
112-
onClick={() => setCategorySelectorVisible(!categorySelectorVisible)}
113-
>
114-
<Filter
115-
width={14}
116-
height={14}
117-
style={{ opacity: categorySelectorVisible ? 0.6 : 1 }}
118-
/>
119-
</Button>
120-
121-
<View
122-
style={{
123-
flexDirection: 'row',
124-
alignItems: 'center',
125-
gap: 5,
126-
}}
127-
>
128-
<View>Average: </View>
129-
<Select
130-
style={{ backgroundColor: 'white' }}
131-
onChange={setNumberOfMonthsAverage}
132-
value={numberOfMonthsAverage}
133-
options={numberOfMonthsOptions.map(number => [
134-
number.value,
135-
number.description,
136-
])}
137-
line={numberOfMonthsLine}
138-
/>
139-
</View>
140-
</>
106+
<View
107+
style={{
108+
flexDirection: 'row',
109+
alignItems: 'center',
110+
gap: 5,
111+
}}
112+
>
113+
<View>Average: </View>
114+
<Select
115+
style={{ backgroundColor: 'white' }}
116+
onChange={setNumberOfMonthsAverage}
117+
value={numberOfMonthsAverage}
118+
options={numberOfMonthsOptions.map(number => [
119+
number.value,
120+
number.description,
121+
])}
122+
line={numberOfMonthsLine}
123+
/>
124+
</View>
141125
);
142126

143127
return (
@@ -153,13 +137,7 @@ function CategoryAverage() {
153137
<View
154138
style={{ display: 'flex', flexDirection: 'row', padding: 15, gap: 15 }}
155139
>
156-
<View
157-
style={{
158-
height: '360',
159-
overflowY: 'scroll',
160-
width: !categorySelectorVisible ? 0 : 'auto',
161-
}}
162-
>
140+
<View style={{ width: 200 }}>
163141
<CategorySelector
164142
categoryGroups={categories.grouped.filter(
165143
categoryGroup => !categoryGroup.is_income,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
category: Enhancements
3+
authors: [MatissJanis]
4+
---
5+
6+
Category spending: improving the visual style of the side-nav

0 commit comments

Comments
 (0)