Created a GridLayout enum and updated all locations to use it. (#208)

So, that we can more easily refactor the code later
This commit is contained in:
amr
2022-12-20 07:05:31 +02:00
committed by GitHub
parent 7312e92d07
commit 2e3f57677e
6 changed files with 42 additions and 26 deletions

View File

@@ -10,7 +10,7 @@ import CheckboxInput from 'components/atoms/CheckboxInput';
import RadioInput from 'components/atoms/RadioInput';
import SortRadioInput from 'components/atoms/SortRadioInput';
import ThreeStateCheckboxInput from 'components/atoms/ThreeStateCheckboxInput';
import { useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import { GridLayout, useLibraryOptionsContext } from 'components/context/LibraryOptionsContext';
import OptionsTabs from 'components/molecules/OptionsTabs';
import React from 'react';
@@ -78,9 +78,9 @@ const LibraryOptionsPanel: React.FC<IProps> = ({ open, onClose }) => {
onChange={(e) => handleFilterChange('gridLayout', Number(e.target.value))}
value={gridLayout}
>
<RadioInput label="Compact grid" value={0} checked={gridLayout == null || gridLayout === 0} />
<RadioInput label="Comfortable grid" value={1} checked={gridLayout === 1} />
<RadioInput label="List" value={2} checked={gridLayout === 2} />
<RadioInput label="Compact grid" value={GridLayout.Compact} checked={gridLayout == null || gridLayout === GridLayout.Compact} />
<RadioInput label="Comfortable grid" value={GridLayout.Comfortable} checked={gridLayout === GridLayout.Comfortable} />
<RadioInput label="List" value={GridLayout.List} checked={gridLayout === GridLayout.List} />
</RadioGroup>
<FormLabel sx={{ mt: 2 }}>Badges</FormLabel>