def serve(self): wp = jp.WebPage() div = jp.Div(a=wp, classes="bg-gray-200 h-screen") jp.Div(a=div, text="Instant Dictionary API", classes="text-4xl m-2") jp.Div(a=div, text="Get definitions of words: ", classes="text-lg") jp.Hr(a=div) jp.Div(a=div, text="www.example.com/api?w=rabbit") jp.Hr(a=div) jp.Div(a=div, text=""" {"word": "rabbit", "definition": ["One of several small mammals of the family Leporidae, with long ears, long hind legs and a short, fluffy tail."]} """) return wp
def serve(self): wp = jp.WebPage() div = jp.Div(a=wp, classes="bg-gray-200 h-screen") jp.Div(a=div, text="Instant Dictionary API", classes="text-4xl m-2") jp.Div(a=div, text="Get definitions of words:", classes="text-lg") jp.Hr(a=div) jp.Div(a=div, text="www.example.com/api?w=moon", classes="text-lg") jp.Hr(a=div) jp.Div(a=div, text=""" {"word": "moon", "definition": ["A natural satellite of a planet.", "A month, particularly a lunar month (approximately 28 days).", "To fuss over adoringly or with great affection.", "Deliberately show ones bare ass (usually to an audience, or at a place, where this is not expected or deemed appropriate).", "To be lost in phantasies or be carried away by some internal vision, having temorarily lost (part of) contact to reality."]} """, classes="text-lg") return wp
async def input_demo(request): wp = jp.WebPage(data={'text':'Initial text'}) button_classes = 'w-32 m-2 bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded' b = jp.Button(text='Reset', click=reset_all, a=wp, classes=button_classes) jp.Hr(a=wp) input_classes = "m-2 bg-gray-200 appearance-none border-2 border-gray-200 rounded xtw-64 py-2 px-4 text-gray-700 focus:outline-none focus:bg-white focus:border-purple-500" for _ in range(5): jp.Input(a=wp, classes=input_classes, placeholder='Please type here', model=[wp, 'text']) for _ in range(3): jp.Div(model=[wp, 'text'], classes='m-2 p-2 h-32 text-xl border-2 overflow-auto', a=wp) return wp