Skip to content

Commit

Permalink
Extract separate components from FeaturesGrid (#86825)
Browse files Browse the repository at this point in the history
  • Loading branch information
oswian authored Feb 6, 2024
1 parent bc06609 commit a445602
Show file tree
Hide file tree
Showing 15 changed files with 760 additions and 659 deletions.
4 changes: 2 additions & 2 deletions packages/plans-grid-next/src/components/actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { isMobile } from '@automattic/viewport';
import styled from '@emotion/styled';
import { useSelect } from '@wordpress/data';
import { useCallback } from '@wordpress/element';
import { localize, TranslateResult, useTranslate } from 'i18n-calypso';
import { TranslateResult, useTranslate } from 'i18n-calypso';
import { usePlansGridContext } from '../grid-context';
import useDefaultStorageOption from '../hooks/data-store/use-default-storage-option';
import useIsLargeCurrency from '../hooks/use-is-large-currency';
Expand Down Expand Up @@ -538,4 +538,4 @@ const PlanFeatures2023GridActions = ( props: PlanFeaturesActionsButtonProps ) =>
);
};

export default localize( PlanFeatures2023GridActions );
export default PlanFeatures2023GridActions;
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import classNames from 'classnames';
import { GridPlan } from '../../types';
import PlanDivOrTdContainer from '../plan-div-td-container';
import BillingTimeframe from '../shared/billing-timeframe';

type BillingTimeframesProps = {
renderedGridPlans: GridPlan[];
showRefundPeriod?: boolean;
options?: {
isTableCell?: boolean;
};
};

const BillingTimeframes = ( {
options,
renderedGridPlans,
showRefundPeriod,
}: BillingTimeframesProps ) => {
return renderedGridPlans.map( ( { planSlug } ) => {
const classes = classNames(
'plan-features-2023-grid__table-item',
'plan-features-2023-grid__header-billing-info'
);

return (
<PlanDivOrTdContainer
className={ classes }
isTableCell={ options?.isTableCell }
key={ planSlug }
>
<BillingTimeframe planSlug={ planSlug } showRefundPeriod={ showRefundPeriod } />
</PlanDivOrTdContainer>
);
} );
};

export default BillingTimeframes;
Loading

0 comments on commit a445602

Please sign in to comment.