-
Notifications
You must be signed in to change notification settings - Fork 708
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
16 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
apps/builder/app/builder/features/topbar/domain-checkbox.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { useStore } from "@nanostores/react"; | ||
import { | ||
Flex, | ||
Tooltip, | ||
Text, | ||
theme, | ||
Link, | ||
buttonStyle, | ||
Checkbox, | ||
} from "@webstudio-is/design-system"; | ||
import { $userPlanFeatures } from "~/builder/shared/nano-states"; | ||
|
||
export const domainToPublishName = "domainToPublish[]"; | ||
|
||
interface DomainCheckboxProps { | ||
defaultChecked?: boolean; | ||
domain: string; | ||
buildId: string | undefined; | ||
disabled?: boolean; | ||
} | ||
|
||
const DomainCheckbox = (props: DomainCheckboxProps) => { | ||
const hasProPlan = useStore($userPlanFeatures).hasProPlan; | ||
|
||
const tooltipContentForFreeUsers = hasProPlan ? undefined : ( | ||
<Flex direction="column" gap="2" css={{ maxWidth: theme.spacing[28] }}> | ||
<Text variant="titles">Publish to Staging</Text> | ||
<Text> | ||
<Flex direction="column"> | ||
Staging allows you to preview a production version of your site | ||
without potentially breaking what production site visitors will see. | ||
<> | ||
<br /> | ||
<br /> | ||
Upgrade to Pro to be able to publish to each domain individually. | ||
<br /> <br /> | ||
<Link | ||
className={buttonStyle({ color: "gradient" })} | ||
color="contrast" | ||
underline="none" | ||
href="https://webstudio.is/pricing" | ||
target="_blank" | ||
> | ||
Upgrade | ||
</Link> | ||
</> | ||
</Flex> | ||
</Text> | ||
</Flex> | ||
); | ||
|
||
const defaultChecked = hasProPlan ? props.defaultChecked : true; | ||
const disabled = hasProPlan ? props.disabled : true; | ||
|
||
return ( | ||
<Tooltip content={tooltipContentForFreeUsers} variant="wrapped"> | ||
<Checkbox | ||
disabled={disabled} | ||
key={props.buildId ?? "-"} | ||
defaultChecked={defaultChecked} | ||
css={{ pointerEvents: "all" }} | ||
name={domainToPublishName} | ||
value={props.domain} | ||
/> | ||
</Tooltip> | ||
); | ||
}; | ||
|
||
export default DomainCheckbox; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.