Skip to main content

A Component generator for Lemon

Project description

Lemon-CLI 🍋📀

Lemon-CLI

Status GitHub Issues GitHub Pull Requests License


Component Generator for Lemon 🍋

📝 Table of Contents

🧐 About

This project is to make your lives easier with lemon, this is also my Hacktoberfest project.

Lemon 🍋 : https://github.com/Sas2k/Lemon

🏁 Getting Started

Installing

With PIP

pip install Lemon-CLI

🎈 Usage

generating a component

Lemon-CLI component <component>

will create

components/
  - <component>.py

Components Implemented

For the ones, that aren't implemented open an issue and describe it or implement it yourself and PR this. (Change the README and related stuff accordingly, Make sure to describe the PR changes well.)

  • App

    A base app in Lemon.

from Lemon.components import Component
from Lemon.Server import server

Root = Component("App")
App = server.Server(None)

class Index(Component):
    name = "Index"
    def item(props: dict):
        return "<h1>Hello World!</h1>"

Root.add(Index)

@App.route("/")
def index(request, response):
    response.text = Root.render("<Index/>")

App.run()
  • Form

    A basic form.

from Lemon.components import Component
from Lemon.ui.forms import FormControl

class Form(Component):
    name = "Form"

    def item(props: dict):
        return """
        <form>
            <div class="form-group">
                <Input type="text" id="TextInput" text="Text Input:" placeholder="placeholder"/>
                <Select id="SelectInput" text="Select Input:" options="Option 1,Option 2,Option 3"//>
                <Checkbox id="CheckboxInput" text="Checkbox Input"/>
                <Submit id="SubmitButton" text="Submit"/>
            </div>
        </form>
        """

components = [Form, FormControl().components]
  • EmailPassword

    A form asking for Email and Password.

from Lemon.components import Component
from Lemon.ui.forms import FormControl

class EmailPassword(Component):
    name = "EmailPassword"

    def item(props: dict):
        return """
        <div class="form-group">
            <form>
                <Input type="email" id="EmailInput" text="Email Input:" placeholder="placeholder"/>
                <Input type="password" id="PasswordInput" text="Password Input:" placeholder="placeholder"/>
                <Submit id="SubmitButton" text="Submit"/>
            </form>
        </div>
        """

components = [EmailPassword, FormControl().components]
  • Page Heading

    A simple page heading.

from Lemon.components import Component

class PageHeading(Component):
    name = "PageHeading"

    def item(props: dict):
        return f"""
        <div style="background-color: {props["color"]}" id="top" class="container-fluid">
            <h1 class="page-heading">{props["text"]}</h1>
        </div>
        """

components = [PageHeading]
  • Article

    Simple article container.

from Lemon.components import Component

class Article(Component):
    name = "Article"

    def item(props: dict):
        return f"""
        <article style="background-color: {props["backgroundColor"]}" class="container-fluid">
            <h2 class="article-heading">{props["articleHeading"]}</h2>
            <span class="article-author"><i>Author: {props["articleAuthor"]}</i></span>
            <p class="article-body">{props["articleBody"]}</p>
        </article>
        """

components = [Article]
  • Footer

    Conditionally rendered footer with author, email, and copyright fields

from Lemon.components import Component

class Footer(Component):
    name = "Footer"

    def item(props: dict):
        _subitems = []

        # user defines order of subitems
        for key in props.keys():
            if key == "footerAuthor":
                _subitems.append(f"Author: {props["footerAuthor"]}" if "footerAuthor" in props)
            elif key == "footerEmail":
                _subitems.append(f"<a href='mailto:{props["footerEmail"]}'>{props["footerEmail"]}</a>")
            elif key == "footerCopyright":
                _subitems.append(f"&copy; {props["footerCopyright"]}")

        return f"""
        <footer style="background-color: {props["backgroundColor"]}">
            <p>
                {_subitems.join(" | " or props["footerDelimiter"])}
            </p>
        </footer>
        """

⛏️ Built Using

✍️ Authors

See also the list of contributors who participated in this project.

🎉 Acknowledgements

  • Hacktoberfest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Lemon-CLI-1.2.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page