mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
enhance(phone/settings): Added labels to settings and misc cleanup
This change alters the default localStorage schema, please clear your localStorage cache for testing
This commit is contained in:
1 parent
5969d33dc3
commit
64c4e0ec16
11 files changed
+290
-210
No files matched your search
@@ -1,7 +1,14 @@
|
||||
import React from 'react';
|
||||
import { ListItem, ListItemText, ListItemIcon } from '@material-ui/core';
|
||||
import {
|
||||
ListItem,
|
||||
ListItemText,
|
||||
ListItemIcon,
|
||||
ListItemSecondaryAction,
|
||||
Box,
|
||||
Slider,
|
||||
} from '@material-ui/core';
|
||||
|
||||
interface IProps {
|
||||
interface ISettingItem {
|
||||
options?: any;
|
||||
label: string;
|
||||
value?: string | number | null;
|
||||
@@ -9,11 +16,35 @@ interface IProps {
|
||||
icon: JSX.Element;
|
||||
}
|
||||
|
||||
export const SettingItem = ({ options, label, value, onClick, icon }: IProps) => {
|
||||
return (
|
||||
<ListItem divider onClick={() => onClick?.(options)} button>
|
||||
<ListItemIcon>{icon}</ListItemIcon>
|
||||
<ListItemText primary={label} secondary={value ? value : undefined} />
|
||||
</ListItem>
|
||||
);
|
||||
};
|
||||
export const SettingItem = ({ options, label, value, onClick, icon }: ISettingItem) => (
|
||||
<ListItem divider onClick={() => onClick?.(options)} button>
|
||||
<ListItemIcon>{icon}</ListItemIcon>
|
||||
<ListItemText primary={label} secondary={value ? value : undefined} />
|
||||
</ListItem>
|
||||
);
|
||||
|
||||
interface ISettingSlider {
|
||||
label: string;
|
||||
icon: JSX.Element;
|
||||
value: number;
|
||||
onCommit: (event: React.ChangeEvent<{}>, value: number | number[]) => void;
|
||||
}
|
||||
|
||||
export const SettingItemSlider = ({ icon, label, value, onCommit }: ISettingSlider) => (
|
||||
<ListItem divider>
|
||||
<ListItemIcon>{icon}</ListItemIcon>
|
||||
<ListItemText primary={label} secondary={`${value}%`} />
|
||||
<ListItemSecondaryAction>
|
||||
<Box p={2} width={150}>
|
||||
<Slider
|
||||
key={`slider-${value}`}
|
||||
defaultValue={value}
|
||||
min={0}
|
||||
max={100}
|
||||
valueLabelDisplay="auto"
|
||||
onChangeCommitted={onCommit}
|
||||
/>
|
||||
</Box>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
);
|
||||
Reference in new issue
Block a user