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

feat(free-trials): Add examples of premium/free-trials for templates #3

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
style: fix indentation for premium feature
denysdovhan committed Nov 20, 2024
commit e8536fe57c9b539d2595dec641dfc1ca55c61955
Original file line number Diff line number Diff line change
@@ -3,33 +3,33 @@ import { FloatingHelper } from '@wix/design-system'
import { useFreeTrialAvailable, useIsFree, useNavigateToPricingPage } from '../hooks/instance';

interface PremiumFeatureProps {
children: React.ReactNode;
children: React.ReactNode;
}

export function PremiumFeature({ children }: PremiumFeatureProps) {
const isFree = useIsFree();
const isFreeTrialAvailable = useFreeTrialAvailable();
const navigateToPricingPage = useNavigateToPricingPage();
const isFree = useIsFree();
const isFreeTrialAvailable = useFreeTrialAvailable();
const navigateToPricingPage = useNavigateToPricingPage();

if (isFree && isFreeTrialAvailable) {
return (
<FloatingHelper
placement="bottom-end"
appearance="light"
initiallyOpened={false}
target={children}
content={
<FloatingHelper.Content
title="Start your free trial"
body="You need a premium subscription to access this feature. Start your free trial now."
actionText="Start Free Trial"
actionTheme="premium"
onActionClick={navigateToPricingPage}
/>
}
/>
);
}
if (isFree && isFreeTrialAvailable) {
return (
<FloatingHelper
placement="bottom-end"
appearance="light"
initiallyOpened={false}
target={children}
content={
<FloatingHelper.Content
title="Start your free trial"
body="You need a premium subscription to access this feature. Start your free trial now."
actionText="Start Free Trial"
actionTheme="premium"
onActionClick={navigateToPricingPage}
/>
}
/>
);
}

return <>{children}</>;
return <>{children}</>;
}