Skip to content

Commit e7864d2

Browse files
committed
Update SearchIcons.js
1 parent d231896 commit e7864d2

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

docs/data/material/components/material-icons/SearchIcons.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ export default function SearchIcons() {
496496
const deferredQuery = React.useDeferredValue(query);
497497
const deferredTheme = React.useDeferredValue(theme);
498498

499+
const isPending = query !== deferredQuery || theme !== deferredTheme;
500+
499501
const icons = React.useMemo(() => {
500502
const keys =
501503
deferredQuery === ''
@@ -527,20 +529,17 @@ export default function SearchIcons() {
527529
<Typography fontWeight={500} sx={{ mb: 1 }}>
528530
Filter the style
529531
</Typography>
530-
<RadioGroup>
532+
<RadioGroup
533+
value={theme}
534+
onChange={(event) => setTheme(event.target.value)}
535+
>
531536
{['Filled', 'Outlined', 'Rounded', 'Two tone', 'Sharp'].map(
532537
(currentTheme) => {
533538
return (
534539
<FormControlLabel
535540
key={currentTheme}
536-
control={
537-
<Radio
538-
size="small"
539-
checked={theme === currentTheme}
540-
onChange={() => setTheme(currentTheme)}
541-
value={currentTheme}
542-
/>
543-
}
541+
value={currentTheme}
542+
control={<Radio size="small" />}
544543
label={currentTheme}
545544
/>
546545
);
@@ -561,11 +560,11 @@ export default function SearchIcons() {
561560
placeholder="Search icons…"
562561
inputProps={{ 'aria-label': 'search icons' }}
563562
endAdornment={
564-
query === deferredQuery ? null : (
563+
isPending ? (
565564
<InputAdornment position="end">
566565
<CircularProgress size={16} sx={{ mr: 2 }} />
567566
</InputAdornment>
568-
)
567+
) : null
569568
}
570569
/>
571570
</Paper>

0 commit comments

Comments
 (0)