From 937f7ffa37c84a9d7390729692b748430412eae6 Mon Sep 17 00:00:00 2001 From: Anurag <25473195+anubrag@users.noreply.github.com> Date: Sat, 6 Jan 2024 03:31:10 +0000 Subject: [PATCH] update blank templates --- .../templates/apps/blank/code/blank.py | 79 ++++++------------- 1 file changed, 24 insertions(+), 55 deletions(-) diff --git a/nextpy/frontend/templates/apps/blank/code/blank.py b/nextpy/frontend/templates/apps/blank/code/blank.py index f619e4f5..f7e23434 100644 --- a/nextpy/frontend/templates/apps/blank/code/blank.py +++ b/nextpy/frontend/templates/apps/blank/code/blank.py @@ -1,74 +1,43 @@ # This file has been modified by the Nextpy Team in 2023 using AI tools and automation scripts. # We have rigorously tested these modifications to ensure reliability and performance. Based on successful test results, we are confident in the quality and stability of these changes. -from xtconfig import config - import nextpy as xt -# This code block represents a style dictionary generated using a large language model (LLM). -# The original prompt for this generation was: "Generate a style dictionary for the following code [paste the code here]". -# Additionally, we have developed the "Nextpy Style Assistant", a tool designed to assist in code styling and best practices. -# This assistant will be available on our Discord server soon for further support and guidance in code styling. - -style = { - "heading": { - "text_align": "center", - "font_size": "28px", - "line_height": "36px", - "color": "#F3F5F7", - "font_family": "DM Sans", - "max_width": "620px", - "padding_top": "16px", - "padding_bottom": "16px", - }, - "get_started_box": { - "font_family": "Inter", - "text_align": "center", - "font_size": "14px", - "color": "black", - "background": "white", - "padding_x": "48px", - "padding_y": "12px", - "border_radius": "lg", - }, - "vertical_stack_style": { - "background": "#04090B", - "height": "100vh", - "padding_top": "20%", - "padding_left":"5%", - "padding_right":"5%", - - } -} - -docs_url = "https://nextpy.org/nextpy/getting-started/introduction" +# Construct the filename to display +from xtconfig import config filename = f"{config.app_name}/{config.app_name}.py" -class State(xt.State): - """The app state.""" - - pass - +# define index page. Frontend Pages are just functions that return a frontend components def index() -> xt.Component: return xt.fragment( xt.vstack( xt.image(src="/logo_darkmode.svg", width="150px"), - xt.text("High performance web apps in pure python with built in AI functions", **style["heading"]), + xt.text( + "High performance web apps in pure python with built in AI functions", + color="#F3F5F7", # Hexadecimal color code for text + font_size="28px", + padding="12px", # Space between an element and its border + max_width="620px", # Maximum width of the text element + ), xt.box( "Get started by editing ", - xt.span(filename, as_="b"), # `as_` exports it as tag : Bold . Default is

tag . More at docs.nextpy.org/typography/text/ + xt.span(filename, as_="b"), # Bold text using tag, default is

tag xt.image(src="/gradient_underline.svg", width="150px"), - **style["get_started_box"] + background="white", + padding="12px 42px", # Vertical padding = 12px & Horizonal padding = 42px + border_radius="lg", # Large border radius ), - **style["vertical_stack_style"] + height="100vh", # Full viewport height + background="#04090B", # Background color + padding_top="20%", # Top padding percentage for responsive design ), ) -# Add state and page to the app. -app = xt.App( - # Add fonts here! - stylesheets=[ - "https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,700&family=Inter&display=swap", - ], -) +# Global styles defined as a Python dictionary +style = { + "text_align": "center", +} + + +app = xt.App(style=style) app.add_page(index)