Skip to content

Commit

Permalink
[docs] Make overview demo work in codesandbox (#10661)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfauquette authored Oct 16, 2023
1 parent 574ce72 commit 2258ff3
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 16 deletions.
20 changes: 16 additions & 4 deletions docs/data/date-pickers/base-concepts/ComponentFamilies.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import Link from 'next/link';
import dayjs from 'dayjs';
import { styled } from '@mui/material/styles';
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
Expand All @@ -13,13 +13,25 @@ import { MultiInputDateTimeRangeField } from '@mui/x-date-pickers-pro/MultiInput
import Stack from '@mui/material/Stack';
import Tooltip from '@mui/material/Tooltip';

const ProSpan = styled('span')({
display: 'inline-block',
height: '1em',
width: '1em',
verticalAlign: 'middle',
marginLeft: '0.3em',
marginBottom: '0.08em',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundImage: 'url(https://mui.com/static/x/pro.svg)',
});

function ProLabel({ children }) {
return (
<Stack direction="row" spacing={0.5} component="span">
<Tooltip title="Included in Pro package">
<Link href="/x/introduction/licensing/#pro-plan">
<span className="plan-pro" />
</Link>
<a href="https://mui.com/x/introduction/licensing/#pro-plan">
<ProSpan />
</a>
</Tooltip>
<span>{children}</span>
</Stack>
Expand Down
20 changes: 16 additions & 4 deletions docs/data/date-pickers/base-concepts/ComponentFamilies.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import Link from 'next/link';
import dayjs from 'dayjs';
import { styled } from '@mui/material/styles';
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
Expand All @@ -13,13 +13,25 @@ import { MultiInputDateTimeRangeField } from '@mui/x-date-pickers-pro/MultiInput
import Stack from '@mui/material/Stack';
import Tooltip from '@mui/material/Tooltip';

const ProSpan = styled('span')({
display: 'inline-block',
height: '1em',
width: '1em',
verticalAlign: 'middle',
marginLeft: '0.3em',
marginBottom: '0.08em',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundImage: 'url(https://mui.com/static/x/pro.svg)',
});

function ProLabel({ children }: { children: React.ReactNode }) {
return (
<Stack direction="row" spacing={0.5} component="span">
<Tooltip title="Included in Pro package">
<Link href="/x/introduction/licensing/#pro-plan">
<span className="plan-pro" />
</Link>
<a href="https://mui.com/x/introduction/licensing/#pro-plan">
<ProSpan />
</a>
</Tooltip>
<span>{children}</span>
</Stack>
Expand Down
20 changes: 16 additions & 4 deletions docs/data/date-pickers/overview/CommonlyUsedComponents.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Link from 'next/link';
import { styled } from '@mui/material/styles';
import Tooltip from '@mui/material/Tooltip';
import Stack from '@mui/material/Stack';
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
Expand All @@ -10,6 +10,18 @@ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';

const ProSpan = styled('span')({
display: 'inline-block',
height: '1em',
width: '1em',
verticalAlign: 'middle',
marginLeft: '0.3em',
marginBottom: '0.08em',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundImage: 'url(https://mui.com/static/x/pro.svg)',
});

function Label({ componentName, valueType, isProOnly }) {
const content = (
<span>
Expand All @@ -21,9 +33,9 @@ function Label({ componentName, valueType, isProOnly }) {
return (
<Stack direction="row" spacing={0.5} component="span">
<Tooltip title="Included on Pro package">
<Link href="/x/introduction/licensing/#pro-plan">
<span className="plan-pro" />
</Link>
<a href="https://mui.com/x/introduction/licensing/#pro-plan">
<ProSpan />
</a>
</Tooltip>
{content}
</Stack>
Expand Down
20 changes: 16 additions & 4 deletions docs/data/date-pickers/overview/CommonlyUsedComponents.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import Link from 'next/link';
import { styled } from '@mui/material/styles';
import Tooltip from '@mui/material/Tooltip';
import Stack from '@mui/material/Stack';
import { DemoContainer, DemoItem } from '@mui/x-date-pickers/internals/demo';
Expand All @@ -10,6 +10,18 @@ import { TimePicker } from '@mui/x-date-pickers/TimePicker';
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
import { DateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';

const ProSpan = styled('span')({
display: 'inline-block',
height: '1em',
width: '1em',
verticalAlign: 'middle',
marginLeft: '0.3em',
marginBottom: '0.08em',
backgroundSize: 'contain',
backgroundRepeat: 'no-repeat',
backgroundImage: 'url(https://mui.com/static/x/pro.svg)',
});

function Label({
componentName,
valueType,
Expand All @@ -29,9 +41,9 @@ function Label({
return (
<Stack direction="row" spacing={0.5} component="span">
<Tooltip title="Included on Pro package">
<Link href="/x/introduction/licensing/#pro-plan">
<span className="plan-pro" />
</Link>
<a href="https://mui.com/x/introduction/licensing/#pro-plan">
<ProSpan />
</a>
</Tooltip>
{content}
</Stack>
Expand Down

0 comments on commit 2258ff3

Please sign in to comment.