diff --git a/packages/ra-ui-materialui/src/Link.stories.tsx b/packages/ra-ui-materialui/src/Link.stories.tsx new file mode 100644 index 00000000000..cfc5022f817 --- /dev/null +++ b/packages/ra-ui-materialui/src/Link.stories.tsx @@ -0,0 +1,53 @@ +import * as React from 'react'; +import { Paper, Stack } from '@mui/material'; +import { AdminContext } from './AdminContext'; +import { Link, LinkProps } from './Link'; +import { defaultDarkTheme, defaultLightTheme } from './theme'; + +export default { title: 'ra-ui-materialui/Link' }; + +export const Basic = ({ + theme, + value, + ...props +}: Partial & { theme?: string; value?: string }) => { + return ( + + + + + Test + + + + + ); +}; + +Basic.argTypes = { + theme: { + options: ['light', 'dark', 'custom'], + control: { type: 'select' }, + }, +}; +Basic.args = { + theme: 'light', +}; diff --git a/packages/ra-ui-materialui/src/Link.tsx b/packages/ra-ui-materialui/src/Link.tsx index a5f39493ebd..b041493bcdf 100644 --- a/packages/ra-ui-materialui/src/Link.tsx +++ b/packages/ra-ui-materialui/src/Link.tsx @@ -37,10 +37,10 @@ export const LinkClasses = { link: `${PREFIX}-link`, }; -const StyledMuiLink = styled(MuiLink)({ +const StyledMuiLink = styled(MuiLink, { name: PREFIX, overridesResolver: (props, styles) => styles.root, -}) as typeof MuiLink; // @see https://mui.com/material-ui/guides/typescript/#complications-with-the-component-prop +})({}) as typeof MuiLink; // @see https://mui.com/material-ui/guides/typescript/#complications-with-the-component-prop // @see https://mui.com/material-ui/guides/composition/#with-typescript export interface LinkProps @@ -50,19 +50,19 @@ export interface LinkProps declare module '@mui/material/styles' { interface ComponentNameToClassKey { - RaLink: 'root' | 'link'; + [PREFIX]: 'root'; } interface ComponentsPropsList { - RaLink: Partial; + [PREFIX]: Partial; } interface Components { RaLink?: { - defaultProps?: ComponentsPropsList['RaLink']; + defaultProps?: ComponentsPropsList[typeof PREFIX]; styleOverrides?: ComponentsOverrides< Omit - >['RaLink']; + >[typeof PREFIX]; }; } }