Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix <SimpleList linkType={false}> UI #10343

Merged
merged 9 commits into from
Nov 14, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,28 @@ export const FullApp = () => (
</AdminContext>
);

export const AnyLink = () => (
erwanMarmelab marked this conversation as resolved.
Show resolved Hide resolved
<AdminContext
dataProvider={dataProvider}
i18nProvider={polyglotI18nProvider(() => defaultMessages, 'en')}
>
<AdminUI>
<Resource
name="books"
list={() => (
<List>
<SimpleList
primaryText={record => record.title}
secondaryText={record => record.author}
linkType={false}
/>
</List>
)}
/>
</AdminUI>
</AdminContext>
);

export const NoPrimaryText = () => (
<AdminContext
dataProvider={dataProvider}
Expand Down
8 changes: 8 additions & 0 deletions packages/ra-ui-materialui/src/list/SimpleList/SimpleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ const LinkOrNot = (
id,
children,
record,
sx,
...rest
} = props;
const createPath = useCreatePath();
Expand All @@ -286,6 +287,12 @@ const LinkOrNot = (
<ListItemText
// @ts-ignore
component="div"
sx={{
paddingX: 2,
paddingY: 1,
erwanMarmelab marked this conversation as resolved.
Show resolved Hide resolved
margin: 0,
...sx,
}}
{...rest}
>
{children}
Expand All @@ -297,6 +304,7 @@ const LinkOrNot = (
<ListItemButton
component={Link}
to={createPath({ resource, id, type })}
sx={{ ...sx }}
erwanMarmelab marked this conversation as resolved.
Show resolved Hide resolved
{...rest}
>
{children}
Expand Down
Loading