mirror of
https://github.com/dergigi/boris.git
synced 2026-02-16 12:34:41 +01:00
- Extract ReadingDisplaySettings component - Extract LayoutNavigationSettings component - Extract StartupPreferencesSettings component - Reduce Settings.tsx from 295 lines to 104 lines
61 lines
2.1 KiB
TypeScript
61 lines
2.1 KiB
TypeScript
import React from 'react'
|
|
import { faList, faThLarge, faImage } from '@fortawesome/free-solid-svg-icons'
|
|
import { UserSettings } from '../../services/settingsService'
|
|
import IconButton from '../IconButton'
|
|
|
|
interface LayoutNavigationSettingsProps {
|
|
settings: UserSettings
|
|
onUpdate: (updates: Partial<UserSettings>) => void
|
|
}
|
|
|
|
const LayoutNavigationSettings: React.FC<LayoutNavigationSettingsProps> = ({ settings, onUpdate }) => {
|
|
return (
|
|
<div className="settings-section">
|
|
<h3 className="section-title">Layout & Navigation</h3>
|
|
|
|
<div className="setting-group setting-inline">
|
|
<label>Default View Mode</label>
|
|
<div className="setting-buttons">
|
|
<IconButton
|
|
icon={faList}
|
|
onClick={() => onUpdate({ defaultViewMode: 'compact' })}
|
|
title="Compact list view"
|
|
ariaLabel="Compact list view"
|
|
variant={(settings.defaultViewMode || 'compact') === 'compact' ? 'primary' : 'ghost'}
|
|
/>
|
|
<IconButton
|
|
icon={faThLarge}
|
|
onClick={() => onUpdate({ defaultViewMode: 'cards' })}
|
|
title="Cards view"
|
|
ariaLabel="Cards view"
|
|
variant={settings.defaultViewMode === 'cards' ? 'primary' : 'ghost'}
|
|
/>
|
|
<IconButton
|
|
icon={faImage}
|
|
onClick={() => onUpdate({ defaultViewMode: 'large' })}
|
|
title="Large preview view"
|
|
ariaLabel="Large preview view"
|
|
variant={settings.defaultViewMode === 'large' ? 'primary' : 'ghost'}
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<div className="setting-group">
|
|
<label htmlFor="collapseOnArticleOpen" className="checkbox-label">
|
|
<input
|
|
id="collapseOnArticleOpen"
|
|
type="checkbox"
|
|
checked={settings.collapseOnArticleOpen !== false}
|
|
onChange={(e) => onUpdate({ collapseOnArticleOpen: e.target.checked })}
|
|
className="setting-checkbox"
|
|
/>
|
|
<span>Collapse bookmark bar when opening an article</span>
|
|
</label>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default LayoutNavigationSettings
|
|
|