Sprocket Rocket
  • Sprocket Rocket Design System
  • Initial Setup
    • Setup HubL Local Server
    • Setup SR App Locally
    • Clone LaunchPad Starter
  • Create a New Module
    • Design
    • Code
    • Implementation
    • Create a Pull Request
    • Fields JSON
  • Code Patterns
    • Design Settings
    • Headings
    • Responsive Images
    • Implementing Forms
    • Typography
    • CTA/Button
    • Spacers
  • PR Review
    • Design / Code Review
    • Implementation Review
  • Handoff Relay Checklist
    • Client Request - Handoff
    • Page/Template Design - Handoff
    • Module Design - Handoff
    • Page/Template Development - Handoff
    • Module Development - Handoff
    • Review & Delivery - Handoff
  • Guides and Tutorials
    • Code Snippets
    • Lazy Loading
    • How to setup the blog subscription notification emails
    • 404 Error Tracking Event with Google Analytics and Google Tag Manager
    • How to setup a form to be used with SR Conversational Form 01
    • Upgrading Bootstrap to Latest Version
  • HS Page Launch (QC)
  • SR Agency Website Review Checklist (QC)
Powered by GitBook
On this page
  • HTML
  • JSON
  1. Code Patterns

CTA/Button

HTML

{% if module.cta.cta_type != 'none' %}
	<div class="btn-wrapper btn-{{ module.cta.cta_style }}-wrapper">
		{% if module.cta.cta_type == 'btn' %}
			<a href="{{ module.cta.link }}" class="cta_button">{{ module.cta.button_text }}</a>
		{% elif module.cta.cta_type == 'cta' %}
			{% cta guid="{{ module.cta.cta }}" %}
		{% endif %}
	</div>
{% endif %}

JSON

{
    "id": "cta",
    "name": "cta",
    "label": "CTA",
    "children": [
        {
            "id": "cta_type",
            "name": "cta_type",
            "label": "CTA Type",
            "required": true,
            "display": "select",
            "choices": [
                [
                    "cta",
                    "HubSpot CTA"
                ],
                [
                    "btn",
                    "Button"
                ],
                [
                    "none",
                    "None"
                ]
            ],
            "type": "choice",
            "default": "btn"
        },
        {
            "name": "cta_style",
            "label": "CTA Style",
            "visibility": {
                "controlling_field": "cta_type",
                "controlling_value_regex": "none",
                "operator": "NOT_EQUAL",
                "access": null
            },
            "display": "select",
            "choices": [
              [
								"primary",
								"Primary"
							],
							[
								"secondary",
								"Secondary"
							],
							[
								"tertiary",
								"Tertiary"
							],
							[
								"white",
								"White"
							],
							[
								"black",
								"Black"
							],
							[
								"outline-primary",
								"Outline Primary"
							],
							[
								"outline-secondary",
								"Outline Secondary"
							],
							[
								"outline-tertiary",
								"Outline Tertiary"
							],
							[
								"outline-white",
								"Outline White"
							],
							[
								"outline-black",
								"Outline Black"
							],
							[
								"none",
								"None"
							]
            ],
            "type": "choice",
            "default": "primary"
        },
        {
            "name": "cta",
            "label": "CTA",
            "visibility": {
                "controlling_field": "cta_type",
                "controlling_value_regex": "cta",
                "operator": "EQUAL",
                "access": null
            },
            "type": "cta",
            "default": ""
        },
        {
            "name": "button_text",
            "label": "Button Text",
            "visibility": {
                "controlling_field": "cta_type",
                "controlling_value_regex": "btn",
                "operator": "EQUAL",
                "access": null
            },
            "type": "text",
            "default": "Learn More"
        },
        {
            "name": "link",
            "label": "Link",
            "visibility": {
                "controlling_field": "cta_type",
                "controlling_value_regex": "btn",
                "operator": "EQUAL",
                "access": null
            },
            "type": "text",
            "default": "#"
        }
    ],
    "type": "group",
    "default": {
        "cta_type": "btn",
        "cta_style": "primary",
        "cta": "",
        "button_text": "Learn More",
        "link": "#"
    }
}
PreviousTypographyNextSpacers

Last updated 4 years ago