Skip to content

Commit

Permalink
[docs] Fix licensingModel -> licenseModel
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Aug 25, 2024
1 parent 026bdcb commit 10f68a2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions docs/pages/pricing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HeroEnd from 'docs/src/components/home/HeroEnd';
import AppFooter from 'docs/src/layouts/AppFooter';
import BrandingCssVarsProvider from 'docs/src/BrandingCssVarsProvider';
import AppHeaderBanner from 'docs/src/components/banner/AppHeaderBanner';
import { LicensingModelProvider } from 'docs/src/components/pricing/LicensingModelContext';
import { LicenseModelProvider } from 'docs/src/components/pricing/LicenseModelContext';

export default function Pricing() {
return (
Expand All @@ -28,7 +28,7 @@ export default function Pricing() {
<main id="main-content">
<HeroPricing />
<Divider />
<LicensingModelProvider>
<LicenseModelProvider>
{/* Mobile, Tablet */}
<Container sx={{ display: { xs: 'block', md: 'none' }, pb: 3, mt: '-1px' }}>
<PricingList />
Expand All @@ -37,7 +37,7 @@ export default function Pricing() {
<Container sx={{ display: { xs: 'none', md: 'block' } }}>
<PricingTable />
</Container>
</LicensingModelProvider>
</LicenseModelProvider>
<PricingWhatToExpect />
<Divider />
<PricingFAQ />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ if (process.env.NODE_ENV !== 'production') {
LicenseModel.displayName = 'LicenseModel';
}

export function LicensingModelProvider(props: any) {
const [licensingModel, setLicensingModel] = React.useState<string>('annual');
export function LicenseModelProvider(props: any) {
const [licenseModel, setLicenseModel] = React.useState<string>('annual');
const value = React.useMemo(
() => ({ licensingModel, setLicensingModel }),
[licensingModel, setLicensingModel],
() => ({ licenseModel, setLicenseModel }),
[licenseModel, setLicenseModel],
);
return <LicenseModel.Provider value={value}>{props.children}</LicenseModel.Provider>;
}

export function useLicensingModel() {
export function useLicenseModel() {
return React.useContext(LicenseModel);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Box from '@mui/material/Box';
import Tooltip from '@mui/material/Tooltip';
import Tabs from '@mui/material/Tabs';
import Tab from '@mui/material/Tab';
import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext';
import { useLicenseModel } from 'docs/src/components/pricing/LicenseModelContext';

const StyledTabs = styled(Tabs)(({ theme }) => ({
margin: '14px auto 4px',
Expand Down Expand Up @@ -94,19 +94,19 @@ const tooltipProps = {
},
};

export default function LicensingModelSwitch() {
const { licensingModel, setLicensingModel } = useLicensingModel();
export default function LicenseModelSwitch() {
const { licenseModel, setLicenseModel } = useLicenseModel();

const handleChange = (event: React.SyntheticEvent, newValue: number) => {
setLicensingModel(newValue);
setLicenseModel(newValue);
};

return (
<Box sx={{ display: 'flex' }}>
<StyledTabs
aria-label="licensing model"
aria-label="license model"
selectionFollowsFocus
value={licensingModel}
value={licenseModel}
onChange={handleChange}
>
<Tab
Expand Down
8 changes: 4 additions & 4 deletions docs/src/components/pricing/PricingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Tab from '@mui/material/Tab';
import KeyboardArrowRightRounded from '@mui/icons-material/KeyboardArrowRightRounded';
import { Link } from '@mui/docs/Link';
import PricingTable, { PlanName, PlanPrice } from 'docs/src/components/pricing/PricingTable';
import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext';
import { useLicenseModel } from 'docs/src/components/pricing/LicenseModelContext';

const Plan = React.forwardRef<
HTMLDivElement,
Expand All @@ -22,7 +22,7 @@ const Plan = React.forwardRef<
>(function Plan({ plan, benefits, unavailable, sx, ...props }, ref) {
const globalTheme = useTheme();
const mode = globalTheme.palette.mode;
const { licensingModel } = useLicensingModel();
const { licenseModel } = useLicenseModel();

return (
<Paper
Expand Down Expand Up @@ -54,11 +54,11 @@ const Plan = React.forwardRef<
{
community: '/material-ui/getting-started/usage/',
pro:
licensingModel === 'annual'
licenseModel === 'annual'
? 'https://mui.com/store/items/mui-x-pro/'
: 'https://mui.com/store/items/mui-x-pro-perpetual/',
premium:
licensingModel === 'annual'
licenseModel === 'annual'
? 'https://mui.com/store/items/mui-x-premium/'
: 'https://mui.com/store/items/mui-x-premium-perpetual/',
}[plan]
Expand Down
24 changes: 12 additions & 12 deletions docs/src/components/pricing/PricingTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import LaunchRounded from '@mui/icons-material/LaunchRounded';
import UnfoldMoreRounded from '@mui/icons-material/UnfoldMoreRounded';
import { Link } from '@mui/docs/Link';
import IconImage from 'docs/src/components/icon/IconImage';
import LicensingModelSwitch from 'docs/src/components/pricing/LicensingModelSwitch';
import { useLicensingModel } from 'docs/src/components/pricing/LicensingModelContext';
import LicenseModelSwitch from 'docs/src/components/pricing/LicenseModelSwitch';
import { useLicenseModel } from 'docs/src/components/pricing/LicenseModelContext';

const planInfo = {
community: {
Expand Down Expand Up @@ -92,8 +92,8 @@ interface PlanPriceProps {
export function PlanPrice(props: PlanPriceProps) {
const { plan } = props;

const { licensingModel } = useLicensingModel();
const annual = licensingModel === 'annual';
const { licenseModel } = useLicenseModel();
const annual = licenseModel === 'annual';
const planPriceMinHeight = 64;

if (plan === 'community') {
Expand Down Expand Up @@ -136,7 +136,7 @@ export function PlanPrice(props: PlanPriceProps) {

return (
<React.Fragment>
<LicensingModelSwitch />
<LicenseModelSwitch />
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', mt: 1, mb: 4 }}>
<Typography
variant="h3"
Expand Down Expand Up @@ -198,7 +198,7 @@ export function PlanPrice(props: PlanPriceProps) {

return (
<React.Fragment>
<LicensingModelSwitch />
<LicenseModelSwitch />
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center', mt: 1, mb: 4 }}>
<Typography
variant="caption"
Expand Down Expand Up @@ -1196,22 +1196,22 @@ function renderMasterRow(key: string, gridSx: object, plans: Array<any>) {

function PricingTableDevelopment(props: any) {
const { renderRow } = props;
const { licensingModel } = useLicensingModel();
const { licenseModel } = useLicenseModel();

return licensingModel === 'annual'
return licenseModel === 'annual'
? renderRow('mui-x-development')
: renderRow('mui-x-development-perpetual');
}

function PricingTableBuyPro() {
const { licensingModel } = useLicensingModel();
const { licenseModel } = useLicenseModel();

return (
<Button
component={Link}
noLinkStyle
href={
licensingModel === 'annual'
licenseModel === 'annual'
? 'https://mui.com/store/items/mui-x-pro/'
: 'https://mui.com/store/items/mui-x-pro-perpetual/'
}
Expand All @@ -1225,14 +1225,14 @@ function PricingTableBuyPro() {
}

function PricingTableBuyPremium() {
const { licensingModel } = useLicensingModel();
const { licenseModel } = useLicenseModel();

return (
<Button
component={Link}
noLinkStyle
href={
licensingModel === 'annual'
licenseModel === 'annual'
? 'https://mui.com/store/items/mui-x-premium/'
: 'https://mui.com/store/items/mui-x-premium-perpetual/'
}
Expand Down

0 comments on commit 10f68a2

Please sign in to comment.