From 420751c4b900af6cf05fe1dcf8e24811ddea1365 Mon Sep 17 00:00:00 2001 From: Drew Powers Date: Sat, 20 Apr 2019 18:17:17 -0600 Subject: [PATCH] Add hide-cta attribute to manifold-product (#83) * Add hide-cta attribute to manifold-product * Add test * Update docs, Prettier cleanup YOLO --- src/components.d.ts | 10 +++++ .../manifold-icon/manifold-icon.tsx | 10 ++--- .../manifold-plan-details.tsx | 9 +++-- .../manifold-plan-menu/manifold-plan-menu.tsx | 2 +- .../manifold-product-details.tsx | 1 - .../manifold-product-page.e2e.ts | 40 +++++++++++++++++++ .../manifold-product-page.tsx | 34 +++++++++------- .../manifold-product-page/readme.md | 1 + .../manifold-product/manifold-product.tsx | 17 ++++++-- src/components/manifold-product/readme.md | 19 ++++++--- .../manifold-service-card.tsx | 7 ++-- src/index.html | 13 ++++++ 12 files changed, 127 insertions(+), 36 deletions(-) diff --git a/src/components.d.ts b/src/components.d.ts index 363d4a602..b68b7ac99 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -356,11 +356,13 @@ export namespace Components { } interface ManifoldProductPage { + 'hideCta'?: boolean; 'linkFormat'?: string; 'product'?: Catalog.ExpandedProduct; 'provider'?: Catalog.Provider; } interface ManifoldProductPageAttributes extends StencilHTMLAttributes { + 'hideCta'?: boolean; 'linkFormat'?: string; 'onManifold-productCTA-click'?: (event: CustomEvent) => void; 'product'?: Catalog.ExpandedProduct; @@ -373,6 +375,10 @@ export namespace Components { */ 'connection': Connection; /** + * _(optional)_ Hide the CTA on the left? + */ + 'hideCta'?: boolean; + /** * _(optional)_ Link format structure, with `:product` placeholder */ 'linkFormat'?: string; @@ -387,6 +393,10 @@ export namespace Components { */ 'connection'?: Connection; /** + * _(optional)_ Hide the CTA on the left? + */ + 'hideCta'?: boolean; + /** * _(optional)_ Link format structure, with `:product` placeholder */ 'linkFormat'?: string; diff --git a/src/components/manifold-icon/manifold-icon.tsx b/src/components/manifold-icon/manifold-icon.tsx index 2f9027764..8dfb12c7b 100644 --- a/src/components/manifold-icon/manifold-icon.tsx +++ b/src/components/manifold-icon/manifold-icon.tsx @@ -60,11 +60,11 @@ export class ManifoldIcon { , ] ) : ( - - )} + + )} ); } diff --git a/src/components/manifold-plan-details/manifold-plan-details.tsx b/src/components/manifold-plan-details/manifold-plan-details.tsx index c46c70a81..c2ca038dc 100644 --- a/src/components/manifold-plan-details/manifold-plan-details.tsx +++ b/src/components/manifold-plan-details/manifold-plan-details.tsx @@ -30,7 +30,8 @@ export class ManifoldPlanDetails { @Event({ eventName: 'manifold-planCTA-click', bubbles: true, - }) ctaClicked: EventEmitter; + }) + ctaClicked: EventEmitter; componentWillLoad() { const features = this.initialFeatures(); @@ -73,9 +74,9 @@ export class ManifoldPlanDetails { }); } return this.linkFormat - .replace(/:product/ig, this.product.body.label) - .replace(/:plan/ig, this.plan.body.label) - .replace(/:features/ig, params.toString()) + .replace(/:product/gi, this.product.body.label) + .replace(/:plan/gi, this.plan.body.label) + .replace(/:features/gi, params.toString()); } get header() { diff --git a/src/components/manifold-plan-menu/manifold-plan-menu.tsx b/src/components/manifold-plan-menu/manifold-plan-menu.tsx index f442d570e..921361ea3 100644 --- a/src/components/manifold-plan-menu/manifold-plan-menu.tsx +++ b/src/components/manifold-plan-menu/manifold-plan-menu.tsx @@ -29,7 +29,7 @@ const PlanButton: FunctionalComponent<{ export class ManifoldPlanMenu { @Prop() plans: Catalog.ExpandedPlan[] = []; @Prop() selectedPlanId: string; - @Prop() selectPlan: Function = () => { }; + @Prop() selectPlan: Function = () => {}; get customPlans() { return Array.isArray(this.plans) diff --git a/src/components/manifold-product-details/manifold-product-details.tsx b/src/components/manifold-product-details/manifold-product-details.tsx index 552896940..43a2ff2ef 100644 --- a/src/components/manifold-product-details/manifold-product-details.tsx +++ b/src/components/manifold-product-details/manifold-product-details.tsx @@ -17,7 +17,6 @@ export class ManifoldProductDetails {

{tagline} -

{this.name} diff --git a/src/index.html b/src/index.html index 5d02c0758..3279294be 100644 --- a/src/index.html +++ b/src/index.html @@ -384,6 +384,12 @@

<manifold-product product-label="aiven-redis" link-format="/product/:product" />
 <!-- <a href="/product/aiven-redis"> -->
+
+

Hide CTA

+

+ You can alternately hide the CTA on the left altogether with hide-cta: +

+
<manifold-product product-label="aiven-cassandra" hide-cta />
 

Properties

@@ -405,6 +411,13 @@

Properties

Connection connections.prod + + hideCta + hide-cta + (optional) Hide the CTA on the left? + boolean | undefined + false + linkFormat link-format