diff --git a/examples/pricing_page.py b/examples/pricing_page.py new file mode 100644 index 0000000..3e1250d --- /dev/null +++ b/examples/pricing_page.py @@ -0,0 +1,28 @@ +from splashgen import launch +from splashgen.components import PricingCard, CTAButton +from splashgen.templates import PricingPage + +site = PricingPage(title="Splashgen - Splash Pages Built In Python", + theme="dark") +site.headline = "Get started immediately!" +site.subtext = """ +Splashgen's plans scale for any organization—from startups to Fortune 500s +""" + +freeCard = PricingCard(tier="Free", price_description="Free forever.") +freeCard.call_to_action = CTAButton( + "https://github.com/true3dco/splashgen", "Get Started") +freeCard.feature_checklist = ["Custom Code", "Unlimited pages", "Continuous deployment"] + +teamsCard = PricingCard(tier="Teams", price_description="8$/month.") +teamsCard.call_to_action = CTAButton( + "https://github.com/true3dco/splashgen", "Sign up") +teamsCard.feature_checklist = [ + "All of the features of free", + "Analytics", + "Custom domains",] + +site.pricing_cards = [freeCard, teamsCard] + + +launch(site) diff --git a/splashgen/components/__init__.py b/splashgen/components/__init__.py index 59f41c1..7b17682 100644 --- a/splashgen/components/__init__.py +++ b/splashgen/components/__init__.py @@ -2,3 +2,4 @@ from .cta_button_secondary import CTAButtonSecondary from .form import Form, TextInput, EmailInput, SelectInput from .link import Link +from .pricing_card import PricingCard diff --git a/splashgen/components/pricing_card.py b/splashgen/components/pricing_card.py new file mode 100644 index 0000000..e6d73e6 --- /dev/null +++ b/splashgen/components/pricing_card.py @@ -0,0 +1,23 @@ +from splashgen import Component + + +class PricingCard(Component): + def __init__(self, tier: str = "<>", price_description: str = "<>", call_to_action: Component = None) -> None: + self.tier = tier + self.price_description = price_description + self.call_to_action: Component = call_to_action + self.feature_checklist: list[str] = None + + def render(self) -> str: + return f""" + +
+

{self.tier}

+

{self.price_description}

+ {self.call_to_action} +
+
+ {self.feature_checklist} +
+ + """ diff --git a/splashgen/jinja_templates/pricing_page.html.jinja b/splashgen/jinja_templates/pricing_page.html.jinja new file mode 100644 index 0000000..20cc97b --- /dev/null +++ b/splashgen/jinja_templates/pricing_page.html.jinja @@ -0,0 +1,137 @@ + + + + + + + {{ title }} + {% for favicon in favicons %} + + {% endfor %} + + {% if meta %} + + + + + + {% if meta.canonical_url %} + + + {% endif %} + + + + + + + {% if meta.image %} + + + {% endif %} {% endif %} + + + + {% if enable_splashgen_analytics %} + + + {% endif %} + + +
+ {# Nav bar #} +
+ {% if logo %} + + {%endif%} + +
+

+ {{ headline }} +

+
+

+ {{ subtext }} +

+
+ + {% for pricing_card in pricing_cards %} +
+
+

{{pricing_card.tier}}

+

{{pricing_card.description}}

+ {{pricing_card.call_to_action}} +
+
+ {% for feature in pricing_card.feature_checklist %} +

{{feature}}

+ {% endfor %} +
+
+ {% endfor %} + +
+ + diff --git a/splashgen/templates/__init__.py b/splashgen/templates/__init__.py index 6cee7f1..b43e450 100644 --- a/splashgen/templates/__init__.py +++ b/splashgen/templates/__init__.py @@ -1,2 +1,3 @@ from .splash_site import SplashSite from .splash_site_2 import SplashSite2 +from .pricing_page import PricingPage \ No newline at end of file diff --git a/splashgen/templates/pricing_page.py b/splashgen/templates/pricing_page.py new file mode 100644 index 0000000..162df51 --- /dev/null +++ b/splashgen/templates/pricing_page.py @@ -0,0 +1,17 @@ +from .base import Template + + +class PricingPage(Template): + + headline: str + subtext: str + pricing_cards = None # : list[PricingCard] + + template = "pricing_page.html.jinja" + + def __init__(self, **kwargs) -> str: + super().__init__(**kwargs) + + self.headline = "Fill out your headline here by assigning to `headline`" + self.subtext = "Fill out subtext by assigning to `subtext`" + self.pricingCards = None