forked from mui/material-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[code-infra] Move BrandingProvider/brandingTheme/InfoCard to @mui/docs (
mui#41206) Signed-off-by: Jan Potoms <2109932+Janpot@users.noreply.github.com> Co-authored-by: Michał Dudak <michal.dudak@gmail.com>
- Loading branch information
1 parent
e01a47e
commit 48ab3ab
Showing
62 changed files
with
1,536 additions
and
1,516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,4 @@ | ||
import * as React from 'react'; | ||
import { ThemeProvider, useTheme } from '@mui/material/styles'; | ||
import { brandingDarkTheme, brandingLightTheme } from 'docs/src/modules/brandingTheme'; | ||
// Backwards compatibility for Toolpad and X. | ||
// TODO: remove when Toolpad and X migrated to `@mui/docs/branding` | ||
|
||
interface BrandingProviderProps { | ||
children: React.ReactNode; | ||
/** | ||
* If not `undefined`, the provider is considered nesting and does not render NextNProgressBar & CssBaseline | ||
*/ | ||
mode: 'light' | 'dark'; | ||
} | ||
|
||
export default function BrandingProvider(props: BrandingProviderProps) { | ||
const { children, mode: modeProp } = props; | ||
const upperTheme = useTheme(); | ||
const mode = modeProp || upperTheme.palette.mode; | ||
const theme = mode === 'dark' ? brandingDarkTheme : brandingLightTheme; | ||
return <ThemeProvider theme={modeProp ? () => theme : theme}>{children}</ThemeProvider>; | ||
} | ||
export { BrandingProvider as default } from '@mui/docs/branding'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,5 @@ | ||
import * as React from 'react'; | ||
import { alpha } from '@mui/material/styles'; | ||
import Box from '@mui/material/Box'; | ||
import Paper from '@mui/material/Paper'; | ||
import Typography, { TypographyProps } from '@mui/material/Typography'; | ||
import { Link, LinkProps } from '@mui/docs/Link'; | ||
// Backwards compatibility for Toolpad and X. | ||
// TODO: remove when Toolpad and X migrated to `@mui/docs/InfoCard` | ||
|
||
interface GlowingIconContainerProps { | ||
icon: React.ReactNode; | ||
} | ||
|
||
export function GlowingIconContainer({ icon }: GlowingIconContainerProps) { | ||
return ( | ||
<Box | ||
sx={(theme) => ({ | ||
width: 40, | ||
height: 40, | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
flexShrink: 0, | ||
borderRadius: 1, | ||
border: '1px solid', | ||
borderColor: 'primary.200', | ||
bgcolor: 'primary.50', | ||
boxShadow: `0px 1px 6px 0px ${alpha( | ||
theme.palette.primary[500], | ||
0.4, | ||
)}, 0px 2px 30px 0px rgba(234, 237, 241, 0.3) inset`, | ||
...theme.applyDarkStyles({ | ||
borderColor: alpha(theme.palette.primary[400], 0.6), | ||
bgcolor: 'primary.900', | ||
boxShadow: `0 2px 6px 0 ${alpha( | ||
theme.palette.primary[600], | ||
0.4, | ||
)}, 0px 2px 30px 0px rgba(0, 0, 0, 0.25) inset`, | ||
}), | ||
})} | ||
> | ||
{icon} | ||
</Box> | ||
); | ||
} | ||
|
||
interface InfoCardProps { | ||
classNameDescription?: string; | ||
classNameTitle?: string; | ||
dense?: boolean; | ||
description?: string; | ||
icon?: React.ReactNode; | ||
link?: string; | ||
prefetch?: LinkProps['prefetch']; | ||
svg?: React.ReactNode; | ||
title: string; | ||
titleProps?: TypographyProps; | ||
} | ||
|
||
export default function InfoCard(props: InfoCardProps) { | ||
const { | ||
classNameDescription, | ||
classNameTitle, | ||
dense, | ||
description, | ||
icon, | ||
link, | ||
svg, | ||
title, | ||
titleProps, | ||
...other | ||
} = props; | ||
return ( | ||
<Paper | ||
variant="outlined" | ||
component={link ? Link : 'div'} | ||
href={link} | ||
{...(link | ||
? { | ||
noLinkStyle: true, | ||
// Fix overloading with prefetch={false}, only prefetch on hover. | ||
prefetch: false, | ||
} | ||
: {})} | ||
sx={(theme) => ({ | ||
p: dense ? 2.5 : 3.5, | ||
height: '100%', | ||
background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, | ||
...theme.applyDarkStyles({ | ||
bgcolor: 'primaryDark.900', | ||
background: `${(theme.vars || theme).palette.gradients.linearSubtle}`, | ||
borderColor: 'primaryDark.700', | ||
}), | ||
})} | ||
{...other} | ||
> | ||
{svg && svg} | ||
{icon && <GlowingIconContainer icon={icon} />} | ||
<Typography | ||
fontWeight="bold" | ||
component="h3" | ||
color="text.primary" | ||
variant="body2" | ||
mt={icon ? 2 : 0} | ||
mb={description ? 0.5 : 0} | ||
className={classNameTitle} | ||
{...titleProps} | ||
> | ||
{title} | ||
</Typography> | ||
<Typography variant="body2" color="text.secondary" className={classNameDescription}> | ||
{description} | ||
</Typography> | ||
</Paper> | ||
); | ||
} | ||
export * from '@mui/docs/InfoCard'; | ||
export { InfoCard as default } from '@mui/docs/InfoCard'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.