show correct title (#111)

This commit is contained in:
Aria Moradi
2021-12-04 10:23:12 +03:30
committed by GitHub
parent ac4aa7d1ca
commit 24addbdb52
2 changed files with 8 additions and 6 deletions

View File

@@ -22,11 +22,12 @@ interface IListDialogProps{
open: boolean
onClose: (arg0: string | null) => void
options: string[]
title: string
}
function ListDialog(props: IListDialogProps) {
const {
value: valueProp, open, onClose, options,
value: valueProp, open, onClose, options, title,
} = props;
const [value, setValue] = React.useState(valueProp);
const radioGroupRef = React.useRef<HTMLDivElement>(null);
@@ -62,12 +63,10 @@ function ListDialog(props: IListDialogProps) {
TransitionProps={{ onEntering: handleEntering }}
open={open}
>
<DialogTitle>Phone Ringtone</DialogTitle>
<DialogTitle>{title}</DialogTitle>
<DialogContent dividers>
<RadioGroup
ref={radioGroupRef}
aria-label="ringtone"
name="ringtone"
value={value}
onChange={handleChange}
>
@@ -139,6 +138,7 @@ export default function ListPreference(props: ListPreferenceProps) {
<ListItemText primary={title} secondary={getSummary()} />
</ListItem>
<ListDialog
title={title}
open={dialogOpen}
onClose={handleDialogClose}
value={findEntryOf(internalCurrentValue)}

View File

@@ -23,11 +23,12 @@ interface IListDialogProps{
open: boolean
onClose: (arg0: string[] | null) => void
values: string[]
title: string
}
function ListDialog(props: IListDialogProps) {
const {
selectedValues: selectedValuesProp, open, onClose, values,
selectedValues: selectedValuesProp, open, onClose, values, title,
} = props;
const [selectedValues, setSelectedValues] = React.useState(selectedValuesProp);
@@ -69,7 +70,7 @@ function ListDialog(props: IListDialogProps) {
maxWidth="xs"
open={open}
>
<DialogTitle>Phone Ringtone</DialogTitle>
<DialogTitle>{title}</DialogTitle>
<DialogContent dividers>
<FormGroup>
{values.map((value) => (
@@ -143,6 +144,7 @@ export default function MultiSelectListPreference(props: MultiSelectListPreferen
<ListItemText primary={title} secondary={getSummary()} />
</ListItem>
<ListDialog
title={title}
open={dialogOpen}
onClose={handleDialogClose}
selectedValues={findEntriesOf(internalCurrentValue)}