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

[docs-infra] Move BrandingProvider/brandingTheme/InfoCard to @mui/docs #41206

Merged
merged 36 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
e082b6a
move BrandinfProvider/brandingTheme/InfocCard to mui/docs
Janpot Feb 20, 2024
1c27549
fwerf
Janpot Feb 20, 2024
c8a6192
Update Demo.js
Janpot Feb 21, 2024
36dc195
frt
Janpot Feb 21, 2024
cb15706
Merge branch 'heads/upstream/master' into branding
Janpot Feb 21, 2024
d9fb110
Update brandingTheme.ts
Janpot Feb 21, 2024
71e7ccd
Merge branch 'heads/upstream/master' into branding
Janpot Feb 23, 2024
8c1ac67
Update brandingTheme.ts
Janpot Feb 23, 2024
12f60ee
icons
Janpot Feb 23, 2024
efe19a4
Update tsconfig.json
Janpot Feb 23, 2024
8327d9a
dew
Janpot Feb 23, 2024
da92145
Merge branch 'heads/upstream/master' into branding
Janpot Feb 23, 2024
b32723c
Merge branch 'heads/upstream/master' into branding
Janpot Mar 11, 2024
6a984db
Update brandingTheme.ts
Janpot Mar 11, 2024
455d50b
Merge branch 'heads/upstream/master' into branding
Janpot Mar 11, 2024
fadd88b
loosen deps
Janpot Mar 15, 2024
9b4158a
Merge remote-tracking branch 'upstream/master' into branding
Janpot Mar 15, 2024
50ce91a
Update pnpm-lock.yaml
Janpot Mar 15, 2024
619c649
Update .npmignore
Janpot Mar 15, 2024
3746608
Update package.json
Janpot Mar 15, 2024
ab04435
Merge branch 'master' into branding
Janpot Mar 18, 2024
3817c51
add versions
Janpot Mar 19, 2024
24ec088
Update package.json
Janpot Mar 19, 2024
47885c6
Update pnpm-lock.yaml
Janpot Mar 19, 2024
b0b6d53
Merge remote-tracking branch 'upstream/master' into branding
Janpot Mar 19, 2024
0eac48c
Update packages/mui-docs/package.json
Janpot Mar 19, 2024
3dfcc98
Merge remote-tracking branch 'upstream/next' into branding
Janpot Mar 25, 2024
95bff36
Update brandingTheme.ts
Janpot Mar 25, 2024
2c70c64
Update pnpm-lock.yaml
Janpot Mar 25, 2024
3f0f309
Merge branch 'next' into branding
Janpot Mar 25, 2024
49785b6
lock
Janpot Mar 25, 2024
8e3708a
Merge branch 'next' into branding
Janpot Mar 26, 2024
c875126
Update pnpm-lock.yaml
Janpot Mar 26, 2024
385698f
Update pnpm-lock.yaml
Janpot Mar 26, 2024
45922b7
Update pnpm-lock.yaml
Janpot Mar 26, 2024
b378348
Merge branch 'next' into branding
Janpot Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/data/joy/components/accordion/AccordionTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Radio from '@mui/joy/Radio';
import Stack from '@mui/joy/Stack';
import Typography from '@mui/joy/Typography';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function AccordionTransition() {
const [transition, setTransition] = React.useState('0.2s ease');
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/badge/BadgeAlignment.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconButton from '@mui/joy/IconButton';
import ArrowUpward from '@mui/icons-material/ArrowUpward';
import ArrowDownward from '@mui/icons-material/ArrowDownward';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function BadgeAlignment() {
const [anchorOrigin, setAnchorOrigin] = React.useState({
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/badge/BadgeAlignment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import IconButton from '@mui/joy/IconButton';
import ArrowUpward from '@mui/icons-material/ArrowUpward';
import ArrowDownward from '@mui/icons-material/ArrowDownward';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function BadgeAlignment() {
const [anchorOrigin, setAnchorOrigin] = React.useState<BadgeProps['anchorOrigin']>(
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/grid/InteractiveGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RadioGroup from '@mui/joy/RadioGroup';
import Radio from '@mui/joy/Radio';
import Sheet from '@mui/joy/Sheet';

import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';

export default function InteractiveGrid() {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/grid/InteractiveGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RadioGroup from '@mui/joy/RadioGroup';
import Radio from '@mui/joy/Radio';
import Sheet from '@mui/joy/Sheet';
import { GridDirection } from '@mui/system';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';

type GridItemsAlignment =
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/grid/SpacingGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RadioGroup from '@mui/joy/RadioGroup';
import Radio from '@mui/joy/Radio';
import Sheet from '@mui/joy/Sheet';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function SpacingGrid() {
const [spacing, setSpacing] = React.useState(2);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/grid/SpacingGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RadioGroup from '@mui/joy/RadioGroup';
import Radio from '@mui/joy/Radio';
import Sheet from '@mui/joy/Sheet';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function SpacingGrid() {
const [spacing, setSpacing] = React.useState(2);
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/stack/InteractiveStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Radio from '@mui/joy/Radio';
import Stack from '@mui/joy/Stack';
import { styled } from '@mui/joy/styles';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

const Item = styled(Sheet)(({ theme }) => ({
...theme.typography['body-sm'],
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/components/stack/InteractiveStack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Radio from '@mui/joy/Radio';
import Stack, { StackProps } from '@mui/joy/Stack';
import { styled } from '@mui/joy/styles';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

const Item = styled(Sheet)(({ theme }) => ({
...theme.typography['body-sm'],
Expand Down
2 changes: 1 addition & 1 deletion docs/data/joy/customization/approaches/ButtonThemes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FormLabel from '@mui/joy/FormLabel';
import Select from '@mui/joy/Select';
import Option from '@mui/joy/Option';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

const githubTheme = extendTheme({
cssVarPrefix: 'gh',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Option from '@mui/joy/Option';
import ArticleRoundedIcon from '@mui/icons-material/ArticleRounded';
import ToggleOffRoundedIcon from '@mui/icons-material/ToggleOffRounded';
import HighlightedCode from 'docs/src/modules/components/HighlightedCode';
import BrandingProvider from 'docs/src/BrandingProvider';
import { BrandingProvider } from '@mui/docs/branding';

export default function ListThemes() {
const [preset, setPreset] = React.useState('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTranslate } from '@mui/docs/i18n';
import ThemeViewer, {
useNodeIdsLazy,
} from 'docs/src/modules/components/ThemeViewer';
import { blue, grey } from 'docs/src/modules/brandingTheme';
import { blue, grey } from '@mui/docs/branding';

const StyledSwitch = styled(Switch)(({ theme }) => [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/_document.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getInitColorSchemeScript as getMuiInitColorSchemeScript } from '@mui/ma
import { getInitColorSchemeScript as getJoyInitColorSchemeScript } from '@mui/joy/styles';
import { pathnameToLanguage } from 'docs/src/modules/utils/helpers';
import createEmotionCache from 'docs/src/createEmotionCache';
import { getMetaThemeColor } from 'docs/src/modules/brandingTheme';
import { getMetaThemeColor } from '@mui/docs/branding';

// You can find a benchmark of the available CSS minifiers under
// https://github.com/GoalSmashers/css-minification-benchmark
Expand Down
2 changes: 1 addition & 1 deletion docs/src/BrandingCssVarsProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
import { NextNProgressBar } from 'docs/src/modules/components/AppFrame';
import { getDesignTokens, getThemedComponents } from 'docs/src/modules/brandingTheme';
import { getDesignTokens, getThemedComponents } from '@mui/docs/branding';
import SkipLink from 'docs/src/modules/components/SkipLink';
import MarkdownLinks from 'docs/src/modules/components/MarkdownLinks';

Expand Down
21 changes: 3 additions & 18 deletions docs/src/BrandingProvider.tsx
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';
2 changes: 1 addition & 1 deletion docs/src/components/about/HowToSupport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import GradientText from 'docs/src/components/typography/GradientText';
import { Link } from '@mui/docs/Link';
import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import { GlowingIconContainer } from 'docs/src/components/action/InfoCard';
import { GlowingIconContainer } from '@mui/docs/InfoCard';

function Widget({
children,
Expand Down
117 changes: 4 additions & 113 deletions docs/src/components/action/InfoCard.tsx
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';
2 changes: 1 addition & 1 deletion docs/src/components/home/MaterialDesignComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import VerifiedUserRounded from '@mui/icons-material/VerifiedUserRounded';
import HelpCenterRounded from '@mui/icons-material/HelpCenterRounded';
import ROUTES from 'docs/src/route';
import { Link } from '@mui/docs/Link';
import { getDesignTokens, getThemedComponents } from 'docs/src/modules/brandingTheme';
import { getDesignTokens, getThemedComponents } from '@mui/docs/branding';

const Grid = styled('div')(({ theme }) => [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/home/ValueProposition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AccessibilityNewRounded from '@mui/icons-material/AccessibilityNewRounded
import GradientText from 'docs/src/components/typography/GradientText';
import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import InfoCard from 'docs/src/components/action/InfoCard';
import { InfoCard } from '@mui/docs/InfoCard';

const content = [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productBaseUI/BaseUIEnd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ListItem from '@mui/material/ListItem';
import Typography from '@mui/material/Typography';
import CompareIcon from '@mui/icons-material/Compare';
import StyleRoundedIcon from '@mui/icons-material/StyleRounded';
import { GlowingIconContainer } from 'docs/src/components/action/InfoCard';
import { GlowingIconContainer } from '@mui/docs/InfoCard';
import GetStartedButtons from 'docs/src/components/home/GetStartedButtons';
import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productBaseUI/BaseUISummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PhishingRoundedIcon from '@mui/icons-material/PhishingRounded';
import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import GradientText from 'docs/src/components/typography/GradientText';
import InfoCard from 'docs/src/components/action/InfoCard';
import { InfoCard } from '@mui/docs/InfoCard';

const content = [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productCore/CoreProducts.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import Grid from '@mui/material/Grid';
import Section from 'docs/src/layouts/Section';
import InfoCard from 'docs/src/components/action/InfoCard';
import { InfoCard } from '@mui/docs/InfoCard';

// Note: All of the commented code will be put back in once logos for each Core product are done.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productDesignKit/DesignKitValues.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LibraryBooks from '@mui/icons-material/LibraryBooks';
import CodeRounded from '@mui/icons-material/CodeRounded';
import GradientText from 'docs/src/components/typography/GradientText';
import Section from 'docs/src/layouts/Section';
import InfoCard from 'docs/src/components/action/InfoCard';
import { InfoCard } from '@mui/docs/InfoCard';

const content = [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productMaterial/MaterialEnd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ListItem from '@mui/material/ListItem';
import Typography from '@mui/material/Typography';
import CompareIcon from '@mui/icons-material/Compare';
import StyleRoundedIcon from '@mui/icons-material/StyleRounded';
import { GlowingIconContainer } from 'docs/src/components/action/InfoCard';
import { GlowingIconContainer } from '@mui/docs/InfoCard';
import GetStartedButtons from 'docs/src/components/home/GetStartedButtons';
import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productMaterial/MaterialHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ import IconImage from 'docs/src/components/icon/IconImage';
import HeroContainer from 'docs/src/layouts/HeroContainer';
import GetStartedButtons from 'docs/src/components/home/GetStartedButtons';
import GradientText from 'docs/src/components/typography/GradientText';
import { getDesignTokens } from 'docs/src/modules/brandingTheme';
import { getDesignTokens } from '@mui/docs/branding';
import { Link } from '@mui/docs/Link';
import ROUTES from 'docs/src/route';

Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/productX/XPlans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Section from 'docs/src/layouts/Section';
import SectionHeadline from 'docs/src/components/typography/SectionHeadline';
import GradientText from 'docs/src/components/typography/GradientText';
import ROUTES from 'docs/src/route';
import InfoCard from 'docs/src/components/action/InfoCard';
import { InfoCard } from '@mui/docs/InfoCard';
import IconImage from 'docs/src/components/icon/IconImage';
import GetStartedButtons from 'docs/src/components/home/GetStartedButtons';

Expand Down
Loading
Loading