Skip to content

Commit 284750d

Browse files
committed
Fix hover effect
1 parent 6bd7306 commit 284750d

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

examples/simple/src/posts/PostShow.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
DataTable,
88
DateField,
99
EditButton,
10+
InPlaceEditor,
1011
NumberField,
1112
ReferenceArrayField,
1213
ReferenceManyField,
@@ -93,7 +94,20 @@ const PostShow = () => {
9394
/>
9495
<NumberField source="average_note" />
9596
<BooleanField source="commentable" />
96-
<TextField source="views" />
97+
<InPlaceEditor
98+
source="views"
99+
sx={{
100+
'& .RaInPlaceEditor-reading div': {
101+
fontSize: 14,
102+
},
103+
'& .RaInPlaceEditor-saving div': {
104+
fontSize: 14,
105+
},
106+
'& .RaInPlaceEditor-editing input': {
107+
fontSize: 14,
108+
},
109+
}}
110+
/>
97111
<CloneButton />
98112
</TabbedShowLayout.Tab>
99113
<TabbedShowLayout.Tab

packages/ra-ui-materialui/src/input/InPlaceEditor/InPlaceEditor.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import CloseIcon from '@mui/icons-material/Close';
1717

1818
import { TextInput } from '../TextInput';
1919
import { TextField } from '../../field';
20+
import { bgcolor } from '@mui/system';
2021

2122
export type InPlaceEditorAction =
2223
| { type: 'edit' }
@@ -263,11 +264,11 @@ const InPlaceEditorClasses = {
263264
const Root = styled('div', {
264265
name: PREFIX,
265266
overridesResolver: (props, styles) => styles.root,
266-
})({
267+
})(({ theme }) => ({
267268
[`& .${InPlaceEditorClasses.reading}`]: {
268269
cursor: 'pointer',
269270
'&:hover': {
270-
backgroundColor: 'action.hover',
271+
backgroundColor: theme.palette.action.hover,
271272
},
272273
},
273274
[`& .${InPlaceEditorClasses.editing}`]: {
@@ -276,4 +277,4 @@ const Root = styled('div', {
276277
gap: 1,
277278
},
278279
[`& .${InPlaceEditorClasses.saving}`]: { opacity: 0.5 },
279-
});
280+
}));

0 commit comments

Comments
 (0)