Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
chore: removes experiment code (#2484)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcarpenter committed Apr 24, 2023
1 parent 0fed2e2 commit 5f48a6e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 100 deletions.
69 changes: 12 additions & 57 deletions components/io-home-hero-alt/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import * as React from 'react'
import classNames from 'classnames'
import { useFlagBag } from 'flags/client'
import Image from 'next/image'
import { abTestTrack } from 'lib/ab-test-track'
import type { Products } from '@hashicorp/platform-product-meta'
import type { IntroProps } from '@hashicorp/react-intro/types'
import { isInUS } from '@hashicorp/platform-util/geo'
import Intro from '@hashicorp/react-intro'
import Button from '@hashicorp/react-button'
import StandaloneLink from '@hashicorp/react-standalone-link'
import s from './style.module.css'

interface IoHomeHeroAltProps {
Expand All @@ -24,10 +18,6 @@ export default function IoHomeHeroAlt({
description,
ctas,
}: IoHomeHeroAltProps) {
const flagBag = useFlagBag()
const renderVariant = React.useMemo(() => {
return isInUS() && flagBag.settled && flagBag.flags?.tryForFree
}, [flagBag])
return (
<header className={s.hero}>
<div className={s.patterns}>
Expand Down Expand Up @@ -57,54 +47,19 @@ export default function IoHomeHeroAlt({
heading={heading}
headingSize={1}
description={description}
// Temporary use custom actions implementation for experiement.
//
// actions={{
// layout: 'stacked',
// theme: brand,
// ctas: ctas.map(
// (cta: { title: string; href: string }, index: number) => {
// return {
// ...cta,
// type: index === 0 ? 'button' : 'standalone-link',
// }
// }
// ) as IntroProps['actions']['ctas'],
// }}
actions={{
layout: 'stacked',
theme: brand,
ctas: ctas.map(
(cta: { title: string; href: string }, index: number) => {
return {
...cta,
type: index === 0 ? 'button' : 'standalone-link',
}
}
) as IntroProps['actions']['ctas'],
}}
/>
<div className={s.actions}>
{ctas.map((cta, index) => {
if (index === 0) {
return (
<Button
key={cta.href}
title={
renderVariant ? 'Try for free' : 'Try Terraform Cloud'
}
url={cta.href}
theme={{ brand }}
onClick={() => {
abTestTrack({
type: 'Result',
test_name: 'io-site primary CTA copy test 03-23',
variant: flagBag.flags?.tryForFree.toString(),
})
}}
className={classNames(
s.actionsPrimary,
flagBag.settled && s.settled
)}
/>
)
}

return (
<StandaloneLink href={cta.href} theme="secondary">
{cta.title}
</StandaloneLink>
)
})}
</div>
</div>
</div>
</header>
Expand Down
19 changes: 2 additions & 17 deletions components/subnav/index.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import * as React from 'react'
import classNames from 'classnames'
import Subnav from '@hashicorp/react-subnav'
import { isInUS } from '@hashicorp/platform-util/geo'
import Link from 'next/link'
import { useFlagBag } from 'flags/client'
import s from './style.module.css'

export default function DefaultSubnav({ menuItems }) {
const flagBag = useFlagBag()
const renderVariant = React.useMemo(() => {
return isInUS() && flagBag.settled && flagBag.flags?.tryForFree
}, [flagBag])
const classnames = classNames(s.subnav, flagBag.settled && s.settled)

return (
<Subnav
className={classnames}
className={s.subnav}
hideGithubStars={true}
titleLink={{ text: 'HashiCorp Terraform', url: '/' }}
ctaLinks={[
Expand All @@ -25,17 +16,11 @@ export default function DefaultSubnav({ menuItems }) {
url: 'https://developer.hashicorp.com/terraform/downloads',
},
{
text: renderVariant ? 'Try for free' : 'Try Terraform Cloud',
text: 'Try Terraform Cloud',
url: 'https://app.terraform.io/public/signup/account',
theme: {
brand: 'terraform',
},
onClick: () =>
abTestTrack({
type: 'Result',
test_name: 'io-site primary CTA copy test 03-23',
variant: renderVariant ? 'true' : 'false',
}),
},
]}
menuItems={menuItems}
Expand Down
15 changes: 1 addition & 14 deletions components/subnav/style.module.css
Original file line number Diff line number Diff line change
@@ -1,14 +1 @@
.subnav {
& [data-ga-button='try-for-free'],
& [data-ga-button='try-terraform-cloud'] {
color: transparent;
min-width: 184px;
}
}

.settled {
& [data-ga-button='try-for-free'],
& [data-ga-button='try-terraform-cloud'] {
color: white;
}
}
/* .subnav {} */
12 changes: 0 additions & 12 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import './style.css'
import '@hashicorp/platform-util/nprogress/style.css'

import { useEffect } from 'react'
import NProgress from '@hashicorp/platform-util/nprogress'
import createConsentManager from '@hashicorp/react-consent-manager/loader'
import localConsentManagerServices from 'lib/consent-manager-services'
Expand All @@ -22,7 +21,6 @@ import alertBannerData, { ALERT_BANNER_ACTIVE } from 'data/alert-banner'
import StandardLayout from 'layouts/standard'
import { useFlags } from 'flags/client'
import { FlagBagProvider } from 'flags/client'
import { abTestTrack } from 'lib/ab-test-track'

NProgress({ Router })
const { ConsentManager } = createConsentManager({
Expand All @@ -44,16 +42,6 @@ function App({ Component, pageProps, layoutData }) {

const Layout = Component.layout ?? StandardLayout

useEffect(() => {
if (flagBag.settled) {
abTestTrack({
type: 'Served',
test_name: 'io-site primary CTA copy test 03-23',
variant: flagBag.flags.tryForFree.toString(),
})
}
}, [flagBag])

return (
<ErrorBoundary FallbackComponent={Error}>
<FlagBagProvider value={flagBag}>
Expand Down

1 comment on commit 5f48a6e

@vercel
Copy link

@vercel vercel bot commented on 5f48a6e Apr 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.